You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sw...@apache.org on 2016/12/01 08:13:45 UTC

[02/50] ambari git commit: AMBARI-18986. Deployment failure when command does not have role (smohanty)

AMBARI-18986. Deployment failure when command does not have role (smohanty)


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

Branch: refs/heads/branch-feature-AMBARI-18901
Commit: 7afe172d20c88abe6b51110364c5200ae1e29618
Parents: 92823a7
Author: Sumit Mohanty <sm...@hortonworks.com>
Authored: Thu Nov 24 10:15:30 2016 -0800
Committer: Sumit Mohanty <sm...@hortonworks.com>
Committed: Thu Nov 24 10:15:30 2016 -0800

----------------------------------------------------------------------
 .../main/python/ambari_agent/CustomServiceOrchestrator.py    | 8 ++++++--
 .../python/ambari_agent/TestCustomServiceOrchestrator.py     | 4 ++--
 2 files changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/7afe172d/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 b814334..770484d 100644
--- a/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
+++ b/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
@@ -42,6 +42,7 @@ class CustomServiceOrchestrator():
   """
 
   SCRIPT_TYPE_PYTHON = "PYTHON"
+  COMMAND_TYPE = "commandType"
   COMMAND_NAME_STATUS = "STATUS"
   COMMAND_NAME_SECURITY_STATUS = "SECURITY_STATUS"
   CUSTOM_ACTION_COMMAND = 'ACTIONEXECUTE'
@@ -58,7 +59,6 @@ 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
@@ -154,7 +154,11 @@ 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)
-        if command['role'] == self.METRICS_GRAFANA:
+        from ActionQueue import ActionQueue  # To avoid cyclic dependency
+        if self.COMMAND_TYPE in command and command[self.COMMAND_TYPE] == ActionQueue.EXECUTION_COMMAND:
+          logger.info("Found it - " + str(command[self.COMMAND_TYPE]) + " yeah")
+          # limiting to only EXECUTION_COMMANDs for now
+          # TODO need a design for limiting to specific role/component such as METRICS_GRAFANA
           self.file_cache.get_dashboard_base_dir(server_url_prefix)
 
         script_path = self.resolve_script_path(base_dir, script)

http://git-wip-us.apache.org/repos/asf/ambari/blob/7afe172d/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 d0d6ac4..2be6e1a 100644
--- a/ambari-agent/src/test/python/ambari_agent/TestCustomServiceOrchestrator.py
+++ b/ambari-agent/src/test/python/ambari_agent/TestCustomServiceOrchestrator.py
@@ -239,6 +239,7 @@ class TestCustomServiceOrchestrator(TestCase):
     
     FileCache_mock.return_value = None
     command = {
+      'commandType' : 'EXECUTION_COMMAND',
       'role' : 'REGION_SERVER',
       'hostLevelParams' : {
         'stack_name' : 'HDP',
@@ -277,8 +278,7 @@ 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)
+    self.assertTrue(get_dashboard_base_dir_mock.called)
 
     run_file_mock.reset_mock()