summaryrefslogtreecommitdiffstats
path: root/yardstick/ssh.py
diff options
context:
space:
mode:
authorMiikka Koistinen <miikka.koistinen@nokia.com>2018-05-09 17:25:51 +0300
committerMiikka Koistinen <miikka.koistinen@nokia.com>2018-06-19 09:30:49 +0300
commit724e49770c517782e269ccdb2320f4a7eb5d87d5 (patch)
treed3e74e54e3df2f0114c14b9723aaaae1ce7a20db /yardstick/ssh.py
parent772d13797e7c84cbc0f8b7ac9005c97b8111cfa8 (diff)
Refactor remote command execution in pktgen
Some remote commands in Pktgen are executed without checking the exit status. This patch makes all remote commands check exit value, and removes unused variables that are captured from remote command executions. JIRA: YARDSTICK-1166 Change-Id: I42a667ebd22d086887d61e1671bc569b03c59d33 Signed-off-by: Miikka Koistinen <miikka.koistinen@nokia.com>
Diffstat (limited to 'yardstick/ssh.py')
-rw-r--r--yardstick/ssh.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/yardstick/ssh.py b/yardstick/ssh.py
index 6b5e6faf4..e6a26ab6b 100644
--- a/yardstick/ssh.py
+++ b/yardstick/ssh.py
@@ -348,12 +348,14 @@ class SSH(object):
raise exceptions.SSHError(error_msg=details)
return exit_status
- def execute(self, cmd, stdin=None, timeout=3600):
+ def execute(self, cmd, stdin=None, timeout=3600, raise_on_error=False):
"""Execute the specified command on the server.
- :param cmd: Command to be executed.
- :param stdin: Open file to be sent on process stdin.
- :param timeout: Timeout for execution of the command.
+ :param cmd: (str) Command to be executed.
+ :param stdin: (StringIO) Open file to be sent on process stdin.
+ :param timeout: (int) Timeout for execution of the command.
+ :param raise_on_error: (bool) If True, then an SSHError will be raised
+ when non-zero exit code.
:returns: tuple (exit_status, stdout, stderr)
"""
@@ -362,7 +364,7 @@ class SSH(object):
exit_status = self.run(cmd, stderr=stderr,
stdout=stdout, stdin=stdin,
- timeout=timeout, raise_on_error=False)
+ timeout=timeout, raise_on_error=raise_on_error)
stdout.seek(0)
stderr.seek(0)
return exit_status, stdout.read(), stderr.read()