'except:' to 'except Exception:' as per HACKING

Change-Id: I6e372152946dc7b51a4d84d6f4b893774e7d1a1d
This commit is contained in:
Joe Gordon 2011-12-27 12:07:06 -08:00
parent cff2ddcbd5
commit 51e7bcf5f4
8 changed files with 13 additions and 13 deletions

View File

@ -157,10 +157,10 @@ class SimpleTenantUsageController(object):
return dtstr
try:
return datetime.strptime(dtstr, "%Y-%m-%dT%H:%M:%S")
except:
except Exception:
try:
return datetime.strptime(dtstr, "%Y-%m-%dT%H:%M:%S.%f")
except:
except Exception:
return datetime.strptime(dtstr, "%Y-%m-%d %H:%M:%S.%f")
def _get_datetime_range(self, req):

View File

@ -323,7 +323,7 @@ class ComputeManager(manager.SchedulerDependentManager):
if instance['task_state'] == task_states.DELETING:
return True
return False
except:
except Exception:
return True
def _shutdown_instance_even_if_deleted(self, context, instance_uuid):
@ -362,7 +362,7 @@ class ComputeManager(manager.SchedulerDependentManager):
instance = self._spawn(context, instance, image_meta,
network_info, block_device_info,
injected_files, admin_password)
except:
except Exception:
with utils.save_and_reraise_exception():
self._deallocate_network(context, instance)
self._notify_about_instance_usage(instance)
@ -460,7 +460,7 @@ class ComputeManager(manager.SchedulerDependentManager):
network_info = self.network_api.allocate_for_instance(
context, instance, vpn=is_vpn,
requested_networks=requested_networks)
except:
except Exception:
msg = _("Instance %s failed network setup")
LOG.exception(msg % instance['uuid'])
raise
@ -475,7 +475,7 @@ class ComputeManager(manager.SchedulerDependentManager):
try:
mapping = self._setup_block_device_mapping(context, instance)
swap, ephemerals, block_device_mapping = mapping
except:
except Exception:
msg = _("Instance %s failed block device setup")
LOG.exception(msg % instance['uuid'])
raise
@ -495,7 +495,7 @@ class ComputeManager(manager.SchedulerDependentManager):
try:
self.driver.spawn(context, instance, image_meta,
network_info, block_device_info)
except:
except Exception:
msg = _("Instance %s failed to spawn")
LOG.exception(msg % instance['uuid'])
raise

View File

@ -107,7 +107,7 @@ class _AnsiColorizer(object):
except curses.error:
curses.setupterm()
return curses.tigetnum("colors") > 2
except:
except Exception:
raise
# guess false in case of error
return False

View File

@ -1090,7 +1090,7 @@ def save_and_reraise_exception():
type_, value, traceback = sys.exc_info()
try:
yield
except:
except Exception:
LOG.exception(_('Original exception being dropped'),
exc_info=(type_, value, traceback))
raise

View File

@ -482,7 +482,7 @@ class VMHelper(HelperBase):
# 4. Create VBD between instance VM and swap VDI
volume_utils.VolumeHelper.create_vbd(
session, vm_ref, vdi_ref, userdevice, bootable=False)
except:
except Exception:
with utils.save_and_reraise_exception():
cls.destroy_vdi(session, vdi_ref)

View File

@ -870,7 +870,7 @@ class ZadaraBEDriver(ISCSIDriver):
volume['host'])
try:
ret = self._common_be_export(context, volume, iscsi_target)
except:
except Exception:
raise exception.ProcessExecutionError
return ret

View File

@ -253,7 +253,7 @@ class API(base.Base):
volume_type=vol_type,
metadata=dict(to_vsa_id=str(vsa_id)),
availability_zone=availability_zone)
except:
except Exception:
self.update_vsa_status(context, vsa_id,
status=VsaState.PARTIAL)
raise

View File

@ -55,7 +55,7 @@ try:
BuildDoc.run(self)
nova_cmdclass['build_sphinx'] = local_BuildDoc
except:
except Exception:
pass