You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sm...@apache.org on 2017/03/13 18:22:18 UTC
ambari git commit: AMBARI-20407. When agent retries commands it needs
to handle credential store processing correctly (smohanty)
Repository: ambari
Updated Branches:
refs/heads/trunk eadbd1d4e -> 991c35b6e
AMBARI-20407. When agent retries commands it needs to handle credential store processing correctly (smohanty)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/991c35b6
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/991c35b6
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/991c35b6
Branch: refs/heads/trunk
Commit: 991c35b6e9c65b1f9953472bfb78a54cd556983a
Parents: eadbd1d
Author: Sumit Mohanty <sm...@hortonworks.com>
Authored: Mon Mar 13 11:19:25 2017 -0700
Committer: Sumit Mohanty <sm...@hortonworks.com>
Committed: Mon Mar 13 11:21:57 2017 -0700
----------------------------------------------------------------------
ambari-agent/src/main/python/ambari_agent/ActionQueue.py | 1 +
.../src/main/python/ambari_agent/CustomServiceOrchestrator.py | 6 +++++-
ambari-agent/src/test/python/ambari_agent/TestActionQueue.py | 2 ++
3 files changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/991c35b6/ambari-agent/src/main/python/ambari_agent/ActionQueue.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/ActionQueue.py b/ambari-agent/src/main/python/ambari_agent/ActionQueue.py
index b1d5160..75880c6 100644
--- a/ambari-agent/src/main/python/ambari_agent/ActionQueue.py
+++ b/ambari-agent/src/main/python/ambari_agent/ActionQueue.py
@@ -316,6 +316,7 @@ class ActionQueue(threading.Thread):
retryDuration -= delay # allow one last attempt
commandresult['stderr'] += "\n\nCommand failed. Retrying command execution ...\n\n"
logger.info("Retrying command with taskId = {cid} after a wait of {delay}".format(cid=taskId, delay=delay))
+ command['commandBeingRetried'] = "true"
time.sleep(delay)
continue
else:
http://git-wip-us.apache.org/repos/asf/ambari/blob/991c35b6/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 8069723..7539710 100644
--- a/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
+++ b/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
@@ -366,7 +366,11 @@ class CustomServiceOrchestrator():
credentialStoreEnabled = (command['credentialStoreEnabled'] == "true")
if credentialStoreEnabled == True:
- self.generateJceks(command)
+ if 'commandBeingRetried' not in command or command['commandBeingRetried'] != "true":
+ self.generateJceks(command)
+ else:
+ logger.info("Skipping generation of jceks files as this is a retry of the command")
+
json_path = self.dump_command_to_json(command, retry)
pre_hook_tuple = self.resolve_hook_script_path(hook_dir,
http://git-wip-us.apache.org/repos/asf/ambari/blob/991c35b6/ambari-agent/src/test/python/ambari_agent/TestActionQueue.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/ambari_agent/TestActionQueue.py b/ambari-agent/src/test/python/ambari_agent/TestActionQueue.py
index 67f0833..ab46f96 100644
--- a/ambari-agent/src/test/python/ambari_agent/TestActionQueue.py
+++ b/ambari-agent/src/test/python/ambari_agent/TestActionQueue.py
@@ -1274,6 +1274,7 @@ class TestActionQueue(TestCase):
}
command = copy.deepcopy(self.retryable_command)
+ self.assertFalse('commandBeingRetried' in command)
with patch.object(CustomServiceOrchestrator, "runCommand") as runCommand_mock:
runCommand_mock.side_effect = [execution_result_fail_dict, execution_result_succ_dict]
actionQueue.execute_command(command)
@@ -1282,6 +1283,7 @@ class TestActionQueue(TestCase):
self.assertTrue(runCommand_mock.called)
self.assertEqual(2, runCommand_mock.call_count)
self.assertEqual(1, sleep_mock.call_count)
+ self.assertEqual(command['commandBeingRetried'], "true")
sleep_mock.assert_any_call(2)
@not_for_platform(PLATFORM_LINUX)