* print all exceptions in cleanup()
* add SshConnectionError, and catch more specific exceptions in polling
This commit is contained in:
parent
665295d394
commit
b0f439cca8
|
@ -212,9 +212,9 @@ class Orchestrator(object):
|
|||
# indicate that servers are ready
|
||||
servers_ready = True
|
||||
break
|
||||
except Exception:
|
||||
print ('servers are not all ready, sleep %s seconds' %
|
||||
self.poll_interval)
|
||||
except (cmd.SshConnectionError, UnboundLocalError) as error:
|
||||
print ('servers are not all ready, error=%s, sleep %s seconds'
|
||||
% (error, self.poll_interval))
|
||||
time.sleep(self.poll_interval)
|
||||
continue
|
||||
if not servers_ready:
|
||||
|
@ -291,7 +291,7 @@ class Orchestrator(object):
|
|||
self._gateway_floating_ip)
|
||||
self.client.floating_ips.delete(self._gateway_floating_ip)
|
||||
except Exception:
|
||||
pass
|
||||
print traceback.format_exc()
|
||||
ids = ([self._chefserver_id, self._gateway_id, self._controller_id] +
|
||||
self._worker_ids)
|
||||
for _id in ids:
|
||||
|
|
|
@ -24,6 +24,11 @@ def local(cmd, screen_output=False):
|
|||
return out.rstrip('\n'), error # remove trailing '\n'
|
||||
|
||||
|
||||
class SshConnectionError(Exception):
|
||||
"""connection error in ssh"""
|
||||
pass
|
||||
|
||||
|
||||
def ssh(uri, cmd, screen_output=False, silent=True, agent_forwarding=False):
|
||||
"""
|
||||
Execute a remote command via ssh
|
||||
|
@ -60,5 +65,5 @@ def ssh(uri, cmd, screen_output=False, silent=True, agent_forwarding=False):
|
|||
"Connection timed out",
|
||||
"Connection refused",
|
||||
"Connection closed by remote host"]):
|
||||
raise RuntimeError('host can not be reached via ssh')
|
||||
raise SshConnectionError('host can not be reached via ssh')
|
||||
return out.rstrip('\n'), error # remove trailing '\n'
|
||||
|
|
Loading…
Reference in New Issue