diff options
| author | Matthew Hooker <matt@cloudscaling.com> | 2011-08-03 19:17:08 -0400 |
|---|---|---|
| committer | Matthew Hooker <matt@cloudscaling.com> | 2011-08-03 19:17:08 -0400 |
| commit | f34a6fb9efd8d950555431f5e7268dbde8ae78c8 (patch) | |
| tree | 3a644a8729b97e69e41c87cb4835bef85b4681a4 /nova/virt | |
| parent | e2770a4558c95aa4b6e276ebe18dc580a82e6d67 (diff) | |
Remove instances of the "diaper pattern"
Anywhere "except:" occurs, I tried to replace it with an explicit except on
known error types. If none were known, Except was used.
In the process I've been able to unearth a few evasive bugs and clean up some
adjacent code.
Diffstat (limited to 'nova/virt')
| -rw-r--r-- | nova/virt/libvirt/connection.py | 6 | ||||
| -rw-r--r-- | nova/virt/libvirt/vif.py | 5 | ||||
| -rw-r--r-- | nova/virt/xenapi_conn.py | 2 |
3 files changed, 7 insertions, 6 deletions
diff --git a/nova/virt/libvirt/connection.py b/nova/virt/libvirt/connection.py index 0acf25d28..4dd8f02e5 100644 --- a/nova/virt/libvirt/connection.py +++ b/nova/virt/libvirt/connection.py @@ -370,7 +370,7 @@ class LibvirtConnection(driver.ComputeDriver): """Returns the xml for the disk mounted at device""" try: doc = libxml2.parseDoc(xml) - except: + except Exception: return None ctx = doc.xpathNewContext() try: @@ -1103,7 +1103,7 @@ class LibvirtConnection(driver.ComputeDriver): try: doc = libxml2.parseDoc(xml) - except: + except Exception: return [] ctx = doc.xpathNewContext() @@ -1144,7 +1144,7 @@ class LibvirtConnection(driver.ComputeDriver): try: doc = libxml2.parseDoc(xml) - except: + except Exception: return [] ctx = doc.xpathNewContext() diff --git a/nova/virt/libvirt/vif.py b/nova/virt/libvirt/vif.py index eef582fac..4be60ce8a 100644 --- a/nova/virt/libvirt/vif.py +++ b/nova/virt/libvirt/vif.py @@ -25,6 +25,7 @@ from nova.network import linux_net from nova.virt.libvirt import netutils from nova import utils from nova.virt.vif import VIFDriver +from nova import exception LOG = logging.getLogger('nova.virt.libvirt.vif') @@ -128,7 +129,7 @@ class LibvirtOpenVswitchDriver(VIFDriver): utils.execute('sudo', 'ovs-vsctl', 'del-port', network['bridge'], dev) utils.execute('sudo', 'ip', 'link', 'delete', dev) - except: + except exception.ProcessExecutionError, e: LOG.warning(_("Failed while unplugging vif of instance '%s'"), instance['name']) - raise + raise e diff --git a/nova/virt/xenapi_conn.py b/nova/virt/xenapi_conn.py index 39afbd650..f75d4493c 100644 --- a/nova/virt/xenapi_conn.py +++ b/nova/virt/xenapi_conn.py @@ -441,7 +441,7 @@ class XenAPISession(object): params = None try: params = eval(exc.details[3]) - except: + except Exception: raise exc raise self.XenAPI.Failure(params) else: |
