Merge "Correct reraising of exception"

This commit is contained in:
Jenkins 2016-09-03 13:12:52 +00:00 committed by Gerrit Code Review
commit 7a16eb685b
8 changed files with 16 additions and 16 deletions

View File

@ -89,7 +89,7 @@ class ManilaException(Exception):
try: try:
message = self.message % kwargs message = self.message % kwargs
except Exception as e: except Exception:
# kwargs doesn't match a variable in the message # kwargs doesn't match a variable in the message
# log the issue and the kwargs # log the issue and the kwargs
LOG.exception(_LE('Exception in string format operation.')) LOG.exception(_LE('Exception in string format operation.'))
@ -97,7 +97,7 @@ class ManilaException(Exception):
LOG.error(_LE("%(name)s: %(value)s"), { LOG.error(_LE("%(name)s: %(value)s"), {
'name': name, 'value': value}) 'name': name, 'value': value})
if CONF.fatal_exception_format_errors: if CONF.fatal_exception_format_errors:
raise e raise
else: else:
# at least get the core message out if something happened # at least get the core message out if something happened
message = self.message message = self.message

View File

@ -254,7 +254,7 @@ class HNASSSHBackend(object):
else: else:
msg = six.text_type(e) msg = six.text_type(e)
LOG.exception(msg) LOG.exception(msg)
raise e raise
def create_directory(self, dest_path): def create_directory(self, dest_path):
self._locked_selectfs('create', dest_path) self._locked_selectfs('create', dest_path)
@ -282,7 +282,7 @@ class HNASSSHBackend(object):
if 'file system is already mounted' not in e.stderr: if 'file system is already mounted' not in e.stderr:
msg = six.text_type(e) msg = six.text_type(e)
LOG.exception(msg) LOG.exception(msg)
raise e raise
def vvol_create(self, vvol_name): def vvol_create(self, vvol_name):
# create a virtual-volume inside directory # create a virtual-volume inside directory
@ -504,7 +504,7 @@ class HNASSSHBackend(object):
else: else:
msg = six.text_type(e) msg = six.text_type(e)
LOG.exception(msg) LOG.exception(msg)
raise e raise
class Export(object): class Export(object):

View File

@ -216,7 +216,7 @@ class RestHelper(object):
except Exception as err: except Exception as err:
LOG.error(_LE('Bad response from change file: %s.') % err) LOG.error(_LE('Bad response from change file: %s.') % err)
raise err raise
def create_share(self, share_name, fs_id, share_proto): def create_share(self, share_name, fs_id, share_proto):
"""Create a share.""" """Create a share."""

View File

@ -332,7 +332,7 @@ class NetAppCmodeClient(client_base.NetAppBaseClient):
LOG.error(_LE("Volume %s is already offline."), LOG.error(_LE("Volume %s is already offline."),
root_volume_name) root_volume_name)
else: else:
raise e raise
vserver_client.delete_volume(root_volume_name) vserver_client.delete_volume(root_volume_name)
elif volumes_count > 1: elif volumes_count > 1:
@ -925,7 +925,7 @@ class NetAppCmodeClient(client_base.NetAppBaseClient):
if e.code == netapp_api.EAPINOTFOUND: if e.code == netapp_api.EAPINOTFOUND:
return None return None
else: else:
raise e raise
if len(aggrs) < 1: if len(aggrs) < 1:
return None return None
@ -2589,7 +2589,7 @@ class NetAppCmodeClient(client_base.NetAppBaseClient):
LOG.debug('Not connected to cluster management LIF.') LOG.debug('Not connected to cluster management LIF.')
return False return False
else: else:
raise e raise
@na_utils.trace @na_utils.trace
def create_cluster_peer(self, addresses, username=None, password=None, def create_cluster_peer(self, addresses, username=None, password=None,

View File

@ -461,11 +461,11 @@ class TegileShareDriver(driver.ShareDriver):
data['qos'] = False data['qos'] = False
super(TegileShareDriver, self)._update_share_stats(data) super(TegileShareDriver, self)._update_share_stats(data)
except Exception as e: except Exception:
msg = _('Unexpected error while trying to get the ' msg = _('Unexpected error while trying to get the '
'usage stats from array.') 'usage stats from array.')
LOG.exception(msg) LOG.exception(msg)
raise e raise
@debugger @debugger
def get_pool(self, share): def get_pool(self, share):

View File

@ -192,9 +192,9 @@ class RestClientURL(object): # pylint: disable=R0902
message=("REST Not Available:" message=("REST Not Available:"
"Please Upgrade")) "Please Upgrade"))
except RestClientError as err: except RestClientError:
del self.headers['authorization'] del self.headers['authorization']
raise err raise
def login(self, auth_str): def login(self, auth_str):
"""Login to an appliance using a user name and password. """Login to an appliance using a user name and password.

View File

@ -302,9 +302,9 @@ class ZFSSAShareDriver(driver.ShareDriver):
name = driver_options['zfssa_name'] name = driver_options['zfssa_name']
try: try:
details = self._get_share_details(name) details = self._get_share_details(name)
except Exception as e: except Exception:
LOG.error(_LE('Cannot manage share %s'), name) LOG.error(_LE('Cannot manage share %s'), name)
raise e raise
lcfg = self.configuration lcfg = self.configuration
input_export_loc = share['export_locations'][0]['path'] input_export_loc = share['export_locations'][0]['path']

View File

@ -511,7 +511,7 @@ class BaseSharesTest(test.BaseTestCase):
d["share"] = cls._create_share( d["share"] = cls._create_share(
*d["args"], **d["kwargs"]) *d["args"], **d["kwargs"])
else: else:
raise e raise
return [d["share"] for d in data] return [d["share"] for d in data]