From b87a238364259eab7fbacf8e7d61c95148cecd70 Mon Sep 17 00:00:00 2001 From: Joe Gordon <jogo@cloudscaling.com> Date: Tue, 21 Feb 2012 00:10:04 -0800 Subject: [PATCH] Exception cleanup Do not write "except:", use "except Exception:" at the very least Change-Id: I539c013132309791f18c46819232102e9232e917 --- nova/virt/baremetal/dom.py | 8 ++++---- nova/virt/baremetal/proxy.py | 4 ++-- nova/virt/baremetal/tilera.py | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/nova/virt/baremetal/dom.py b/nova/virt/baremetal/dom.py index 013a2dc2ab..423d273e70 100644 --- a/nova/virt/baremetal/dom.py +++ b/nova/virt/baremetal/dom.py @@ -130,7 +130,7 @@ class BareMetalDom(object): try: self.baremetal_nodes.deactivate_node(fd['node_id']) - except: + except Exception: msg = _("Failed power down Bare-metal node %s") raise exception.NotFound(msg % fd['node_id']) self.change_domain_state(name, power_state.BUILDING) @@ -139,7 +139,7 @@ class BareMetalDom(object): node_ip, name, fd['mac_address'], fd['ip_address']) self.change_domain_state(name, state) return state - except: + except Exception: LOG.debug(_("deactivate -> activate fails")) self.destroy_domain(name) raise @@ -165,7 +165,7 @@ class BareMetalDom(object): self.store_domain() msg = _("After storing domains: %s") LOG.debug(msg % (self.domains)) - except: + except Exception: LOG.debug(_("deactivation/removing domain failed")) raise @@ -207,7 +207,7 @@ class BareMetalDom(object): node_ip, new_dom['name'], new_dom['mac_address'], new_dom['ip_address'], new_dom['user_data']) self.change_domain_state(new_dom['name'], state) - except: + except Exception: self.domains.remove(new_dom) self.baremetal_nodes.free_node(node_id) LOG.debug(_("Failed to boot Bare-metal node %s"), node_id) diff --git a/nova/virt/baremetal/proxy.py b/nova/virt/baremetal/proxy.py index 1d65027837..b651ee2c41 100644 --- a/nova/virt/baremetal/proxy.py +++ b/nova/virt/baremetal/proxy.py @@ -188,7 +188,7 @@ class ProxyConnection(driver.ComputeDriver): if state == power_state.RUNNING: LOG.debug(_('instance %s: rebooted'), instance['name']) timer.stop() - except: + except Exception: LOG.exception(_('_wait_for_reboot failed')) timer.stop() timer.f = _wait_for_reboot @@ -221,7 +221,7 @@ class ProxyConnection(driver.ComputeDriver): if state == power_state.RUNNING: LOG.debug(_('instance %s: rescued'), instance['name']) timer.stop() - except: + except Exception: LOG.exception(_('_wait_for_rescue failed')) timer.stop() timer.f = _wait_for_reboot diff --git a/nova/virt/baremetal/tilera.py b/nova/virt/baremetal/tilera.py index 3cc36d48f8..d79ce153df 100644 --- a/nova/virt/baremetal/tilera.py +++ b/nova/virt/baremetal/tilera.py @@ -228,7 +228,7 @@ class BareMetalNodes(object): try: utils.execute('sudo', 'umount', '-f', pathx) utils.execute('sudo', 'rm', '-f', pathx) - except: + except Exception: LOG.debug(_("rootfs is already removed")) def network_set(self, node_ip, mac_address, ip_address):