Apply retries when ping execution fails due to ssh issues
When tobiko executes remote ping commands, they could fail due to: - command error - error connecting to the remove server to run ping In the second case, the exception raised is a RetryLimitError. If that exception is not captured, retries cannot be applied. Change-Id: I00a76bb16de14440b25aeda00ee25b8d196992dd
This commit is contained in:
parent
ff9c70dbc4
commit
f650d7adcb
@ -331,10 +331,10 @@ def execute_ping(parameters, ssh_client=None, check=True):
|
|||||||
timeout=parameters.deadline + 3.,
|
timeout=parameters.deadline + 3.,
|
||||||
expect_exit_status=None,
|
expect_exit_status=None,
|
||||||
network_namespace=parameters.network_namespace)
|
network_namespace=parameters.network_namespace)
|
||||||
except sh.ShellError as ex:
|
except (sh.ShellError, tobiko.RetryLimitError) as ex:
|
||||||
LOG.exception("Error executing ping command")
|
LOG.exception("Error executing ping command")
|
||||||
stdout = ex.stdout
|
stdout = ex.stdout if hasattr(ex, "stdout") else None
|
||||||
stderr = ex.stderr
|
stderr = ex.stderr if hasattr(ex, "stderr") else None
|
||||||
else:
|
else:
|
||||||
stdout = result.stdout
|
stdout = result.stdout
|
||||||
stderr = result.stderr
|
stderr = result.stderr
|
||||||
|
@ -352,11 +352,12 @@ class ShellProcessFixture(tobiko.SharedFixture):
|
|||||||
attempt.check_limits()
|
attempt.check_limits()
|
||||||
except tobiko.RetryTimeLimitError:
|
except tobiko.RetryTimeLimitError:
|
||||||
LOG.exception("retry timeout expired")
|
LOG.exception("retry timeout expired")
|
||||||
|
# Eventually raises either ShellCommandTimeout exception or
|
||||||
|
# RetryTimeLimitError
|
||||||
|
self.get_exit_status(timeout=timeout)
|
||||||
|
raise
|
||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
# Eventually raises ShellCommandTimeout exception
|
|
||||||
self.get_exit_status(timeout=timeout)
|
|
||||||
raise StopIteration
|
|
||||||
|
|
||||||
def _is_communicating(self, streams, send, receive):
|
def _is_communicating(self, streams, send, receive):
|
||||||
if send and self.stdin in streams:
|
if send and self.stdin in streams:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user