X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=yardstick%2Fssh.py;h=e6a26ab6b19548819123e6f4af86e0d9c530df1c;hb=5ca6368e609d9dc8ec19590835d91b36b2d1fa78;hp=6b5e6faf45fbbe2f74af512ec2056ed3e4ecddbb;hpb=008e77b99f31dafa124c6a34724969ef16d5ef7a;p=yardstick.git 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()