From fe0605c7cfdbe6b566ce1ebe78f9f12dfce89e65 Mon Sep 17 00:00:00 2001 From: Luc Provoost Date: Fri, 2 Apr 2021 14:53:09 +0200 Subject: Log ssh & scp related issues also on screen When scripts are doing an ssh or scp to the PROX instances, errors were sometimes hidden. E.g. when we try to upload a config file to the PROX instance that is already existing but owned by another user, we would not see the error on the screen. Note this will only happen if you build your own image. In case you use the pre-canned PROX images, this should not cause issues. Change-Id: I94176b737cd548c93afc71450a85910d7eca2b0c Signed-off-by: Luc Provoost --- VNFs/DPPD-PROX/helper-scripts/rapid/prox_ctrl.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/prox_ctrl.py b/VNFs/DPPD-PROX/helper-scripts/rapid/prox_ctrl.py index 3389bd6c..9f4539cb 100644 --- a/VNFs/DPPD-PROX/helper-scripts/rapid/prox_ctrl.py +++ b/VNFs/DPPD-PROX/helper-scripts/rapid/prox_ctrl.py @@ -59,8 +59,6 @@ class prox_ctrl(object): if attempts > 20: RapidLog.exception("Failed to connect to instance after %d\ attempts:\n%s" % (attempts, ex)) - raise Exception("Failed to connect to instance after %d \ - attempts:\n%s" % (attempts, ex)) time.sleep(2) RapidLog.debug("Trying to connect to machine \ on %s, attempt: %d" % (self._ip, attempts)) @@ -79,8 +77,6 @@ class prox_ctrl(object): if attempts > 20: RapidLog.exception("Failed to connect to PROX on %s after %d \ attempts" % (self._ip, attempts)) - raise Exception("Failed to connect to PROX on %s after %d \ - attempts" % (self._ip, attempts)) time.sleep(2) RapidLog.debug("Trying to connect to PROX (just launched) on %s, \ attempt: %d" % (self._ip, attempts)) @@ -101,10 +97,7 @@ class prox_ctrl(object): try: return subprocess.check_output(cmd, stderr=subprocess.STDOUT) except subprocess.CalledProcessError as ex: - #if _connect and ex.returncode == 255: - if _connect: - raise RuntimeWarning(ex.output.strip()) - raise RuntimeError('ssh returned exit status %d:\n%s' + RapidLog.exception('ssh returned exit status %d:\n%s' % (ex.returncode, ex.output.strip())) def prox_sock(self, port=8474): @@ -139,7 +132,7 @@ class prox_ctrl(object): # Actually ignore output on success, but capture stderr on failure subprocess.check_output(cmd, stderr=subprocess.STDOUT) except subprocess.CalledProcessError as ex: - raise RuntimeError('scp returned exit status %d:\n%s' + RapidLog.exception('scp returned exit status %d:\n%s' % (ex.returncode, ex.output.strip())) def scp_get(self, src, dst): @@ -161,7 +154,7 @@ class prox_ctrl(object): # Actually ignore output on success, but capture stderr on failure subprocess.check_output(cmd, stderr=subprocess.STDOUT) except subprocess.CalledProcessError as ex: - raise RuntimeError('scp returned exit status %d:\n%s' + RapidLog.exception('scp returned exit status %d:\n%s' % (ex.returncode, ex.output.strip())) def _build_ssh(self, command): -- cgit 1.2.3-korg