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