Correct reraising of exception
when an exception was caught and rethrown, it should call 'raise' without any arguments. Change-Id: Ie40b4bfade6298f2168c3292386dd94ffea48757
This commit is contained in:
@@ -121,9 +121,9 @@ class OpenstackException(Exception):
|
||||
try:
|
||||
self._error_string = self.message % kwargs
|
||||
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
if _FATAL_EXCEPTION_FORMAT_ERRORS:
|
||||
raise e
|
||||
raise
|
||||
else:
|
||||
# at least get the core message out if something happened
|
||||
self._error_string = self.message
|
||||
|
||||
@@ -66,9 +66,9 @@ class SecurityGroup(DatabaseModelBase):
|
||||
user=context.user,
|
||||
tenant_id=context.tenant)
|
||||
|
||||
except exception.SecurityGroupCreationError as e:
|
||||
except exception.SecurityGroupCreationError:
|
||||
LOG.exception(_("Failed to create remote security group."))
|
||||
raise e
|
||||
raise
|
||||
|
||||
@classmethod
|
||||
def create_for_instance(cls, instance_id, context):
|
||||
@@ -163,9 +163,9 @@ class SecurityGroupRule(DatabaseModelBase):
|
||||
cidr=cidr,
|
||||
group_id=sec_group['id'])
|
||||
|
||||
except exception.SecurityGroupRuleCreationError as e:
|
||||
except exception.SecurityGroupRuleCreationError:
|
||||
LOG.exception(_("Failed to create remote security group."))
|
||||
raise e
|
||||
raise
|
||||
|
||||
def get_security_group(self, tenant_id):
|
||||
return SecurityGroup.find_by(id=self.group_id,
|
||||
|
||||
@@ -95,14 +95,14 @@ class CbBackup(base.BackupRunner):
|
||||
operating_system.copy(system.pwd_file,
|
||||
system.COUCHBASE_DUMP_DIR,
|
||||
preserve=True, as_root=True)
|
||||
except exception.ProcessExecutionError as p:
|
||||
LOG.error(p)
|
||||
raise p
|
||||
except exception.ProcessExecutionError:
|
||||
LOG.exception(_("Error during pre-backup phase."))
|
||||
raise
|
||||
|
||||
def _run_post_backup(self):
|
||||
try:
|
||||
for cmd in self.post_backup_commands:
|
||||
utils.execute_with_timeout(*cmd)
|
||||
except exception.ProcessExecutionError as p:
|
||||
LOG.error(p)
|
||||
raise p
|
||||
except exception.ProcessExecutionError:
|
||||
LOG.exception(_("Error during post-backup phase."))
|
||||
raise
|
||||
|
||||
@@ -62,10 +62,10 @@ class DB2Backup(base.BackupRunner):
|
||||
'dbname': dbName, 'dir': DB2_BACKUP_DIR})
|
||||
|
||||
service.run_command(system.UNQUIESCE_DB2)
|
||||
except exception.ProcessExecutionError as e:
|
||||
except exception.ProcessExecutionError:
|
||||
LOG.debug("Caught exception when preparing the directory")
|
||||
self.cleanup()
|
||||
raise e
|
||||
raise
|
||||
|
||||
@property
|
||||
def cmd(self):
|
||||
|
||||
@@ -70,10 +70,10 @@ class MongoDump(base.BackupRunner):
|
||||
run_as_root=True, root_helper='sudo',
|
||||
timeout=LARGE_TIMEOUT
|
||||
)
|
||||
except exception.ProcessExecutionError as e:
|
||||
except exception.ProcessExecutionError:
|
||||
LOG.debug("Caught exception when creating the dump")
|
||||
self.cleanup()
|
||||
raise e
|
||||
raise
|
||||
|
||||
@property
|
||||
def cmd(self):
|
||||
|
||||
@@ -45,9 +45,9 @@ class CbBackup(base.RestoreRunner):
|
||||
def pre_restore(self):
|
||||
try:
|
||||
operating_system.remove(system.COUCHBASE_DUMP_DIR, force=True)
|
||||
except exception.ProcessExecutionError as p:
|
||||
LOG.error(p)
|
||||
raise p
|
||||
except exception.ProcessExecutionError:
|
||||
LOG.exception(_("Error during pre-restore phase."))
|
||||
raise
|
||||
|
||||
def post_restore(self):
|
||||
try:
|
||||
|
||||
@@ -1781,7 +1781,7 @@ class ResizeActionBase(object):
|
||||
self._assert_processes_are_ok()
|
||||
LOG.debug("Confirming nova action")
|
||||
self._confirm_nova_action()
|
||||
except Exception as ex:
|
||||
except Exception:
|
||||
LOG.exception(_("Exception during nova action."))
|
||||
if need_to_revert:
|
||||
LOG.error(_("Reverting action for instance %s") %
|
||||
@@ -1797,7 +1797,7 @@ class ResizeActionBase(object):
|
||||
"Nova server status is not ACTIVE"))
|
||||
|
||||
LOG.error(_("Error resizing instance %s.") % self.instance.id)
|
||||
raise ex
|
||||
raise
|
||||
|
||||
LOG.debug("Recording success")
|
||||
self._record_action_success()
|
||||
|
||||
@@ -69,7 +69,7 @@ class TestUsers(object):
|
||||
self.dbaas.databases.create(instance_info.id, databases)
|
||||
except exceptions.BadRequest as e:
|
||||
if "Validation error" in e.message:
|
||||
raise e
|
||||
raise
|
||||
if not FAKE:
|
||||
time.sleep(5)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user