|
|
@ -332,11 +332,14 @@ def _ssh_retry(func):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
return_tuple = func(self, *args, **kwargs)
|
|
|
|
return_tuple = func(self, *args, **kwargs)
|
|
|
|
|
|
|
|
if self._play_context.no_log:
|
|
|
|
|
|
|
|
display.vvv('rc=%s, stdout & stderr censored due to no log' % return_tuple[0], host=self.host)
|
|
|
|
|
|
|
|
else:
|
|
|
|
display.vvv(return_tuple, host=self.host)
|
|
|
|
display.vvv(return_tuple, host=self.host)
|
|
|
|
# 0 = success
|
|
|
|
# 0 = success
|
|
|
|
# 1-254 = remote command return code
|
|
|
|
# 1-254 = remote command return code
|
|
|
|
# 255 could be a failure from the ssh command itself
|
|
|
|
# 255 could be a failure from the ssh command itself
|
|
|
|
except (AnsibleControlPersistBrokenPipeError) as e:
|
|
|
|
except (AnsibleControlPersistBrokenPipeError):
|
|
|
|
# Retry one more time because of the ControlPersist broken pipe (see #16731)
|
|
|
|
# Retry one more time because of the ControlPersist broken pipe (see #16731)
|
|
|
|
cmd = args[0]
|
|
|
|
cmd = args[0]
|
|
|
|
if self._play_context.password and isinstance(cmd, list):
|
|
|
|
if self._play_context.password and isinstance(cmd, list):
|
|
|
@ -354,8 +357,12 @@ def _ssh_retry(func):
|
|
|
|
break
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
|
|
if SSH_ERROR:
|
|
|
|
if SSH_ERROR:
|
|
|
|
raise AnsibleConnectionFailure("Failed to connect to the host via ssh: %s"
|
|
|
|
msg = "Failed to connect to the host via ssh: "
|
|
|
|
% to_native(return_tuple[2]))
|
|
|
|
if self._play_context.no_log:
|
|
|
|
|
|
|
|
msg += '<error censored due to no log>'
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
msg += to_native(return_tuple[2])
|
|
|
|
|
|
|
|
raise AnsibleConnectionFailure(msg)
|
|
|
|
|
|
|
|
|
|
|
|
break
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
|
|