Repository: ambari Updated Branches: refs/heads/trunk b7d55f0c9 -> fc46088d9
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/fc46088d Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/fc46088d Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/fc46088d Branch: refs/heads/trunk Commit: fc46088d9a9943c8e6bd7ea9b29512064faf72c4 Parents: b7d55f0 Author: Sumit Mohanty <smoha...@hortonworks.com> Authored: Thu Nov 24 10:15:30 2016 -0800 Committer: Sumit Mohanty <smoha...@hortonworks.com> Committed: Thu Nov 24 10:16:11 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/fc46088d/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/fc46088d/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()