1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2024-10-06 10:51:13 +01:00

ssh: fixing rasing of CalledProcessErrorWithStderr

CalledProcessErrorWithStderr is a subclass of CalledProcessError that
also takes stderr output. Both that and normal output must be passed as
keyword arguments. They were being passed as keyword arguments inside
_scp() of SshConnection, causing cryptic errors to appear.

Additionally, "output" was not being properly poped off before invoking
super's init.
This commit is contained in:
Sergei Trofimov 2016-08-23 17:14:45 +01:00
parent fe259dca05
commit 4ea4bc8631
2 changed files with 3 additions and 1 deletions

View File

@ -85,6 +85,7 @@ class TimeoutError(Exception):
class CalledProcessErrorWithStderr(CalledProcessError):
def __init__(self, *args, **kwargs):
self.output = kwargs.pop("output")
self.error = kwargs.pop("error")
super(CalledProcessErrorWithStderr, self).__init__(*args, **kwargs)

View File

@ -245,7 +245,8 @@ class SshShell(object):
except subprocess.CalledProcessError as e:
raise CalledProcessErrorWithStderr(e.returncode,
e.cmd.replace(pass_string, ''),
e.output, getattr(e, 'error', ''))
output=e.output,
error=getattr(e, 'error', ''))
except TimeoutError as e:
raise TimeoutError(e.command.replace(pass_string, ''), e.output)