Revert "Fix retry counter delays"
This reverts commit 4a0c89ce91a2d6e6f410b2b65bb705262a8b0011.
Change-Id: I231e5f04ae590661dc006d1ddbce8bb38ae69d26
diff --git a/tcp_tests/managers/execute_commands.py b/tcp_tests/managers/execute_commands.py
index 29e2f4b..3c01867 100644
--- a/tcp_tests/managers/execute_commands.py
+++ b/tcp_tests/managers/execute_commands.py
@@ -64,20 +64,18 @@
# skip_fail = step.get('skip_fail', False)
msg = "[ {0} #{1} ] {2}".format(label, n + 1, description)
+ LOG.info("\n\n{0}\n{1}".format(msg, '=' * len(msg)))
if action_cmd:
- self.execute_command(step, msg)
- return
+ self.execute_command(step)
elif action_do:
- self.command2(step, msg)
- return
- LOG.info("\n\n{0}\n{1}".format(msg, '=' * len(msg)))
- if action_upload:
+ self.command2(step)
+ elif action_upload:
self.action_upload(step)
elif action_download:
self.action_download(step)
- def execute_command(self, step, msg):
+ def execute_command(self, step):
# Required fields
cmd = step.get('cmd')
node_name = step.get('node_name')
@@ -92,13 +90,7 @@
for x in range(retry_count, 0, -1):
time.sleep(3)
-
- retry_msg = ' (try {0} of {1}, skip_fail={2})'.format(
- retry_count - x + 1, retry_count, skip_fail)
- LOG.info("\n\n{0}\n{1}".format(
- msg + retry_msg, '=' * len(msg + retry_msg)))
-
- result = remote.execute('set -ex; ' + cmd, verbose=True)
+ result = remote.execute(cmd, verbose=True)
# Workaround of exit code 0 from salt in case of failures
failed = 0
@@ -114,11 +106,16 @@
if result.exit_code != 0:
time.sleep(retry_delay)
+ LOG.info(
+ " === RETRY ({0}/{1}) ========================="
+ .format(x - 1, retry_count))
elif failed != 0:
LOG.error(
" === SALT returned exit code = 0 while "
"there are failed modules! ===")
- time.sleep(retry_delay)
+ LOG.info(
+ " === RETRY ({0}/{1}) ======================="
+ .format(x - 1, retry_count))
else:
break
@@ -127,7 +124,7 @@
raise Exception("Step '{0}' failed"
.format(description))
- def command2(self, step, msg):
+ def command2(self, step):
# Required fields
do = step['do']
target = step['target']
@@ -148,11 +145,6 @@
for x in range(retry_count, 0, -1):
time.sleep(3)
- retry_msg = ' (try {0} of {1}, skip_fail={2})'.format(
- retry_count - x + 1, retry_count, skip_fail)
- LOG.info("\n\n{0}\n{1}".format(
- msg + retry_msg, '=' * len(msg + retry_msg)))
-
method = getattr(self._salt, self._salt._map[do])
command_ret = method(tgt=target, state=state or states,
args=args, kwargs=kwargs)
@@ -171,6 +163,8 @@
LOG.error("States finished with failures.\n{}".format(
all_fails))
time.sleep(retry_delay)
+ LOG.info(" === RETRY ({0}/{1}) ========================="
+ .format(x - 1, retry_count))
else:
break