From 2e12507ea31c52f6b81ad3bcbdbe872aa3c505c4 Mon Sep 17 00:00:00 2001 From: micafer Date: Thu, 14 Sep 2017 13:34:36 +0200 Subject: [PATCH] Campture SSH errors in wait_ssh_access --- contextualization/ctxt_agent_dist.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/contextualization/ctxt_agent_dist.py b/contextualization/ctxt_agent_dist.py index ec56f01fd..aa967d301 100755 --- a/contextualization/ctxt_agent_dist.py +++ b/contextualization/ctxt_agent_dist.py @@ -138,6 +138,10 @@ def wait_ssh_access(vm, delay=10, max_wait=None, quiet=False): res = "new" except AuthenticationException: try_ansible_key = True + except: + if not quiet: + CtxtAgent.logger.exception("Error connecting with SSH with: " + vm_ip) + success = False if try_ansible_key: # In some very special cases the last two cases fail, so check @@ -150,8 +154,13 @@ def wait_ssh_access(vm, delay=10, max_wait=None, quiet=False): success = ssh_client.test_connectivity() res = 'pk_file' except: - CtxtAgent.logger.exception("Error connecting with SSH with: " + vm_ip) + if not quiet: + CtxtAgent.logger.exception("Error connecting with SSH with: " + vm_ip) success = False + except: + if not quiet: + CtxtAgent.logger.exception("Error connecting with SSH with: " + vm_ip) + success = False if success: vm['ctxt_ip'] = vm_ip