1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-01-31 02:00:45 +00:00

utils/ssh: Remove original traceback from exception

In Python 3 when re-raising an exception the original traceback will
also be included. In the `_scp` method we do not want to expose the
password so hide the original exception when re-raising.
This commit is contained in:
Marc Bonnici 2018-11-21 14:02:20 +00:00 committed by setrofim
parent 389ec76c1e
commit efbf630422

View File

@ -27,6 +27,7 @@ import sys
import time
import atexit
from pipes import quote
from future.utils import raise_from
# pylint: disable=import-error,wrong-import-position,ungrouped-imports,wrong-import-order
import pexpect
@ -315,8 +316,8 @@ class SshConnection(object):
try:
check_output(command, timeout=timeout, shell=True)
except subprocess.CalledProcessError as e:
raise HostError("Failed to copy file with '{}'. Output:\n{}".format(
command_redacted, e.output))
raise_from(HostError("Failed to copy file with '{}'. Output:\n{}".format(
command_redacted, e.output)), None)
except TimeoutError as e:
raise TimeoutError(command_redacted, e.output)