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
This commit is contained in:
Slawek Kaplonski 2020-02-06 10:41:36 +01:00
parent 6b151cfd44
commit 86620dacc6
2 changed files with 8 additions and 8 deletions

View File

@ -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)

View File

@ -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)