ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ttho...@apache.org
Subject ambari git commit: AMBARI-18960 - Dashboards directory only needs to be sync'd for METRICS_GRAFANA
Date Tue, 22 Nov 2016 16:58:04 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 93fcf515f -> 38834dd5d


AMBARI-18960 - Dashboards directory only needs to be sync'd for METRICS_GRAFANA


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/38834dd5
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/38834dd5
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/38834dd5

Branch: refs/heads/branch-2.5
Commit: 38834dd5da45031a8be1927a9be965929abc8de9
Parents: 93fcf51
Author: Tim Thorpe <tthorpe@apache.org>
Authored: Tue Nov 22 08:57:42 2016 -0800
Committer: Tim Thorpe <tthorpe@apache.org>
Committed: Tue Nov 22 08:57:42 2016 -0800

----------------------------------------------------------------------
 .../ambari_agent/CustomServiceOrchestrator.py   |  4 +++-
 .../TestCustomServiceOrchestrator.py            | 21 ++++++++++++++++++++
 2 files changed, 24 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/38834dd5/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py b/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
index fbc1509..b814334 100644
--- a/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
+++ b/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
@@ -58,6 +58,7 @@ class CustomServiceOrchestrator():
   AMBARI_SERVER_HOST = "ambari_server_host"
   AMBARI_SERVER_PORT = "ambari_server_port"
   AMBARI_SERVER_USE_SSL = "ambari_server_use_ssl"
+  METRICS_GRAFANA = "METRICS_GRAFANA"
 
   FREQUENT_COMMANDS = [COMMAND_NAME_SECURITY_STATUS, COMMAND_NAME_STATUS]
   DONT_DEBUG_FAILURES_FOR_COMMANDS = FREQUENT_COMMANDS
@@ -153,7 +154,8 @@ class CustomServiceOrchestrator():
         self.file_cache.get_host_scripts_base_dir(server_url_prefix)          
         hook_dir = self.file_cache.get_hook_base_dir(command, server_url_prefix)
         base_dir = self.file_cache.get_service_base_dir(command, server_url_prefix)
-        self.file_cache.get_dashboard_base_dir(server_url_prefix)
+        if command['role'] == self.METRICS_GRAFANA:
+          self.file_cache.get_dashboard_base_dir(server_url_prefix)
 
         script_path = self.resolve_script_path(base_dir, script)
         script_tuple = (script_path, base_dir)

http://git-wip-us.apache.org/repos/asf/ambari/blob/38834dd5/ambari-agent/src/test/python/ambari_agent/TestCustomServiceOrchestrator.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/ambari_agent/TestCustomServiceOrchestrator.py b/ambari-agent/src/test/python/ambari_agent/TestCustomServiceOrchestrator.py
index 9f1241e..d0d6ac4 100644
--- a/ambari-agent/src/test/python/ambari_agent/TestCustomServiceOrchestrator.py
+++ b/ambari-agent/src/test/python/ambari_agent/TestCustomServiceOrchestrator.py
@@ -277,6 +277,8 @@ class TestCustomServiceOrchestrator(TestCase):
     self.assertEqual(ret['exitcode'], 0)
     self.assertTrue(run_file_mock.called)
     self.assertEqual(run_file_mock.call_count, 3)
+    # Should only be called for METRICS_GRAFANA
+    self.assertFalse(get_dashboard_base_dir_mock.called)
 
     run_file_mock.reset_mock()
 
@@ -299,6 +301,25 @@ class TestCustomServiceOrchestrator(TestCase):
 
     run_file_mock.reset_mock()
 
+    # For role=METRICS_GRAFANA, dashboards should be sync'd
+    command['role'] = 'METRICS_GRAFANA'
+    get_dashboard_base_dir_mock.reset_mock()
+    get_dashboard_base_dir_mock.return_value = "/dashboards/"
+
+    run_file_mock.return_value = {
+        'stdout' : 'sss',
+        'stderr' : 'eee',
+        'exitcode': 0,
+      }
+    ret = orchestrator.runCommand(command, "out.txt", "err.txt")
+    self.assertEqual(ret['exitcode'], 0)
+    self.assertTrue(run_file_mock.called)
+    self.assertEqual(run_file_mock.call_count, 3)
+    self.assertTrue(get_dashboard_base_dir_mock.called)
+
+    command['role'] = 'REGION_SERVER'
+    run_file_mock.reset_mock()
+
     # unknown script type case
     command['commandParams']['script_type'] = "SOME_TYPE"
     ret = orchestrator.runCommand(command, "out.txt", "err.txt")


Mime
View raw message