diff options
author | Luc Provoost <luc.provoost@intel.com> | 2021-04-02 14:53:09 +0200 |
---|---|---|
committer | Luc Provoost <luc.provoost@intel.com> | 2021-04-07 12:31:18 +0000 |
commit | fe0605c7cfdbe6b566ce1ebe78f9f12dfce89e65 (patch) | |
tree | bf5900cdef908cc1551e19ebebb2bd320382376d | |
parent | 6bffe8d5a58d62a377bbad0025b604f4be04a3b0 (diff) |
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 <luc.provoost@intel.com>
-rw-r--r-- | VNFs/DPPD-PROX/helper-scripts/rapid/prox_ctrl.py | 13 |
1 files 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): |