From e19ca4eb1571795de90111857566eecdadcb78f8 Mon Sep 17 00:00:00 2001 From: Valeriy Ponomaryov Date: Fri, 11 Jul 2014 07:51:50 -0400 Subject: [PATCH] Fix usage of ProcessExecutionError exception Commit https://github.com/stackforge/manila/commit/2d9a89a065ba7dbed9bb6ae1464a3b9ec99474a7 made changes to Manila, where it uses 'ssh_execute' function from common code. But exception that is used was not changed. So, set old exception as link to new one. Change-Id: If266f07b4c93c50f59f09336b766ce8f8e415509 Closes-Bug: #1340684 --- manila/exception.py | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/manila/exception.py b/manila/exception.py index c141592d45..a98911e05a 100644 --- a/manila/exception.py +++ b/manila/exception.py @@ -27,8 +27,8 @@ import six from sqlalchemy import exc as sqa_exc import webob.exc - from manila.openstack.common import log as logging +from manila.openstack.common import processutils LOG = logging.getLogger(__name__) @@ -42,6 +42,9 @@ CONF = cfg.CONF CONF.register_opts(exc_log_opts) +ProcessExecutionError = processutils.ProcessExecutionError + + class ConvertedException(webob.exc.WSGIHTTPException): def __init__(self, code=0, title="", explanation=""): self.code = code @@ -50,25 +53,6 @@ class ConvertedException(webob.exc.WSGIHTTPException): super(ConvertedException, self).__init__() -class ProcessExecutionError(IOError): - def __init__(self, stdout=None, stderr=None, exit_code=None, cmd=None, - description=None): - self.exit_code = exit_code - self.stderr = stderr - self.stdout = stdout - self.cmd = cmd - self.description = description - - if description is None: - description = _('Unexpected error while running command.') - if exit_code is None: - exit_code = '-' - message = _('%(description)s\nCommand: %(cmd)s\n' - 'Exit code: %(exit_code)s\nStdout: %(stdout)r\n' - 'Stderr: %(stderr)r') % locals() - IOError.__init__(self, message) - - class Error(Exception): pass