Skip to content

Commit

Permalink
orchestra/remote: throw exception on reconnect failed
Browse files Browse the repository at this point in the history
In run method if a reconnect required there is a remote.reconnect
method called which is supposed to return True or False.
On failure it is the best to raise an exception early,
to make it clear what was the original error instead of
waiting until somewhere later teuthology fails with
some undeclared variables.

Signed-off-by: Kyr Shatskyy <[email protected]>
  • Loading branch information
Kyr Shatskyy committed Jun 20, 2022
1 parent 30e505b commit f51b7d6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion teuthology/orchestra/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,8 @@ def run(self, **kwargs):
if not self.ssh or \
not self.ssh.get_transport() or \
not self.ssh.get_transport().is_active():
self.reconnect()
if not self.reconnect():
raise Exception(f'Cannot connect to remote host {self.shortname}')
r = self._runner(client=self.ssh, name=self.shortname, **kwargs)
r.remote = self
return r
Expand Down

0 comments on commit f51b7d6

Please sign in to comment.