Narrow down except clause

To avoid masking brainfarts like the ones that led to
bug report below.

Related-bug: #1368835

Change-Id: I028b779e580da7719925a8e127f48bbe1aec211e
This commit is contained in:
armando-migliaccio
2014-09-12 12:43:12 -07:00
parent 3e9efcdd6f
commit 19527c4504
7 changed files with 9 additions and 9 deletions

View File

@@ -20,7 +20,7 @@ from neutronclient.neutron import v2_0 as neutronV20
def _format_timestamp(component):
try:
return component['heartbeat_timestamp'].split(".", 2)[0]
except Exception:
except (TypeError, KeyError):
return ''

View File

@@ -30,7 +30,7 @@ def _format_firewall_rules(firewall_policy):
output = '[' + ',\n '.join([rule for rule in
firewall_policy['firewall_rules']]) + ']'
return output
except Exception:
except (TypeError, KeyError):
return ''

View File

@@ -25,7 +25,7 @@ def _format_subnets(network):
try:
return '\n'.join([' '.join([s['id'], s.get('cidr', '')])
for s in network['subnets']])
except Exception:
except (TypeError, KeyError):
return ''

View File

@@ -26,7 +26,7 @@ from neutronclient.openstack.common import jsonutils
def _format_fixed_ips(port):
try:
return '\n'.join([jsonutils.dumps(ip) for ip in port['fixed_ips']])
except Exception:
except (TypeError, KeyError):
return ''

View File

@@ -27,7 +27,7 @@ from neutronclient.openstack.common import jsonutils
def _format_external_gateway_info(router):
try:
return jsonutils.dumps(router['external_gateway_info'])
except Exception:
except (TypeError, KeyError):
return ''

View File

@@ -27,7 +27,7 @@ def _format_allocation_pools(subnet):
try:
return '\n'.join([jsonutils.dumps(pool) for pool in
subnet['allocation_pools']])
except Exception:
except (TypeError, KeyError):
return ''
@@ -35,7 +35,7 @@ def _format_dns_nameservers(subnet):
try:
return '\n'.join([jsonutils.dumps(server) for server in
subnet['dns_nameservers']])
except Exception:
except (TypeError, KeyError):
return ''
@@ -43,7 +43,7 @@ def _format_host_routes(subnet):
try:
return '\n'.join([jsonutils.dumps(route) for route in
subnet['host_routes']])
except Exception:
except (TypeError, KeyError):
return ''

View File

@@ -28,7 +28,7 @@ def _format_peer_cidrs(ipsec_site_connection):
try:
return '\n'.join([jsonutils.dumps(cidrs) for cidrs in
ipsec_site_connection['peer_cidrs']])
except Exception:
except (TypeError, KeyError):
return ''