Merge "Narrow down except clause"
This commit is contained in:
@@ -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 ''
|
||||
|
||||
|
||||
|
||||
@@ -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 ''
|
||||
|
||||
|
||||
|
||||
@@ -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 ''
|
||||
|
||||
|
||||
|
||||
@@ -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 ''
|
||||
|
||||
|
||||
|
||||
@@ -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 ''
|
||||
|
||||
|
||||
|
||||
@@ -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 ''
|
||||
|
||||
|
||||
|
||||
@@ -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 ''
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user