- ret_code, stdout, stderr = exec_cmd(
- node, cmd, timeout=timeout, sudo=sudo, disconnect=disconnect)
- msg = ('Command execution failed: "{cmd}"\n{stderr}'.
- format(cmd=cmd, stderr=stderr) if message is None else message)
- if ret_code != 0:
+ for _ in range(retries + 1):
+ ret_code, stdout, stderr = exec_cmd(
+ node, cmd, timeout=timeout, sudo=sudo, disconnect=disconnect)
+ if ret_code == 0:
+ break
+ sleep(1)
+ else:
+ msg = 'Command execution failed: "{cmd}"\nRC: {rc}\n{stderr}'.format(
+ cmd=cmd, rc=ret_code, stderr=stderr)
+ logger.info(msg)
+ if message:
+ if include_reason:
+ msg = message + '\n' + msg
+ else:
+ msg = message