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.,
|
||||
expect_exit_status=None,
|
||||
network_namespace=parameters.network_namespace)
|
||||
except sh.ShellError as ex:
|
||||
except (sh.ShellError, tobiko.RetryLimitError) as ex:
|
||||
LOG.exception("Error executing ping command")
|
||||
stdout = ex.stdout
|
||||
stderr = ex.stderr
|
||||
stdout = ex.stdout if hasattr(ex, "stdout") else None
|
||||
stderr = ex.stderr if hasattr(ex, "stderr") else None
|
||||
else:
|
||||
stdout = result.stdout
|
||||
stderr = result.stderr
|
||||
|
@ -352,11 +352,12 @@ class ShellProcessFixture(tobiko.SharedFixture):
|
||||
attempt.check_limits()
|
||||
except tobiko.RetryTimeLimitError:
|
||||
LOG.exception("retry timeout expired")
|
||||
# Eventually raises either ShellCommandTimeout exception or
|
||||
# RetryTimeLimitError
|
||||
self.get_exit_status(timeout=timeout)
|
||||
raise
|
||||
else:
|
||||
return
|
||||
# Eventually raises ShellCommandTimeout exception
|
||||
self.get_exit_status(timeout=timeout)
|
||||
raise StopIteration
|
||||
|
||||
def _is_communicating(self, streams, send, receive):
|
||||
if send and self.stdin in streams:
|
||||
|
Loading…
Reference in New Issue
Block a user