From f51b7d60467f85776fe2731edad1240eb232d7b6 Mon Sep 17 00:00:00 2001 From: Kyr Shatskyy Date: Wed, 15 Sep 2021 12:11:21 +0200 Subject: [PATCH] orchestra/remote: throw exception on reconnect failed 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 --- teuthology/orchestra/remote.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/teuthology/orchestra/remote.py b/teuthology/orchestra/remote.py index 634ce76004..c7bbf172b5 100644 --- a/teuthology/orchestra/remote.py +++ b/teuthology/orchestra/remote.py @@ -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