From 86620dacc6a7d0b11e5a40431a4e2786c2a027b4 Mon Sep 17 00:00:00 2001 From: Slawek Kaplonski Date: Thu, 6 Feb 2020 10:41:36 +0100 Subject: [PATCH] Stop using not existing ShellCommandError exception class In commit [1] was introduced exception class ShellCommandFailed and it should be used in common.shell module. But by mistake there was used not existing ShellCommandError class there. This patch fixes that. [1] https://review.opendev.org/#/c/612978/ Change-Id: I0b51165ea4d541b0cd2f5820a64cd7a82f23c6c9 --- neutron_tempest_plugin/common/shell.py | 14 +++++++------- neutron_tempest_plugin/exceptions.py | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/neutron_tempest_plugin/common/shell.py b/neutron_tempest_plugin/common/shell.py index bd4a7a31..eebb07d7 100644 --- a/neutron_tempest_plugin/common/shell.py +++ b/neutron_tempest_plugin/common/shell.py @@ -46,7 +46,7 @@ def execute(command, ssh_client=None, timeout=None, check=True): :param timeout: command execution timeout in seconds - :param check: when False it doesn't raises ShellCommandError when + :param check: when False it doesn't raises ShellCommandFailed when exit status is not zero. True by default :returns: STDOUT text when command execution terminates with zero exit @@ -57,7 +57,7 @@ def execute(command, ssh_client=None, timeout=None, check=True): try to read STDOUT and STDERR buffers (not fully implemented) before raising the exception. - :raises ShellCommandError: when command execution terminates with non-zero + :raises ShellCommandFailed: when command execution terminates with non-zero exit status. """ ssh_client = ssh_client or SSH_PROXY_CLIENT @@ -110,7 +110,7 @@ def execute_remote_command(command, ssh_client, timeout=None): except lib_exc.SSHExecCommandFailed as ex: # Please note class SSHExecCommandFailed has been re-based on - # top of ShellCommandError + # top of ShellCommandFailed stdout = ex.stdout stderr = ex.stderr exit_status = ex.exit_status @@ -174,7 +174,7 @@ class ShellExecuteResult(collections.namedtuple( stdout=self.stdout) elif self.exit_status != 0: - raise exceptions.ShellCommandError(command=self.command, - exit_status=self.exit_status, - stderr=self.stderr, - stdout=self.stdout) + raise exceptions.ShellCommandFailed(command=self.command, + exit_status=self.exit_status, + stderr=self.stderr, + stdout=self.stdout) diff --git a/neutron_tempest_plugin/exceptions.py b/neutron_tempest_plugin/exceptions.py index 895cb407..398bc1c8 100644 --- a/neutron_tempest_plugin/exceptions.py +++ b/neutron_tempest_plugin/exceptions.py @@ -96,5 +96,5 @@ exceptions.SSHExecCommandFailed = utils.override_class( exceptions.SSHExecCommandFailed, ShellCommandFailed) # Above code created a new SSHExecCommandFailed class based on top -# of ShellCommandError +# of ShellCommandFailed assert issubclass(exceptions.SSHExecCommandFailed, ShellCommandFailed)