mirror of
https://github.com/CumulusNetworks/ifupdown2.git
synced 2024-05-06 15:54:50 +00:00
SONAR: Specify an exception class to catch or reraise the exception
Signed-off-by: Julien Fortin <jfortin@nvidia.com>
This commit is contained in:
2
Makefile
2
Makefile
@@ -6,7 +6,7 @@ import os, webbrowser, sys
|
||||
|
||||
try:
|
||||
from urllib import pathname2url
|
||||
except:
|
||||
except Exception:
|
||||
from urllib.request import pathname2url
|
||||
|
||||
webbrowser.open("file://" + pathname2url(os.path.abspath(sys.argv[1])))
|
||||
|
@@ -238,9 +238,9 @@ class address(AddonWithIpBlackList, moduleBase):
|
||||
)
|
||||
try:
|
||||
self.l3_intf_arp_accept = int(l3_intf_arp_accept_str)
|
||||
except:
|
||||
except ValueError:
|
||||
self.l3_intf_arp_accept = int(strtobool(l3_intf_arp_accept_str))
|
||||
except:
|
||||
except Exception:
|
||||
self.l3_intf_arp_accept = 0
|
||||
|
||||
self.l3_intf_default_gateway_set_onlink = utils.get_boolean_from_string(
|
||||
@@ -469,7 +469,7 @@ class address(AddonWithIpBlackList, moduleBase):
|
||||
try:
|
||||
if utils.mac_str_to_int(old_mac_addr) != utils.mac_str_to_int(hwaddress):
|
||||
self.iproute2.bridge_fdb_del(bridgename, old_mac_addr, vlan)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
if up:
|
||||
# check statemanager to delete the old entry if necessary
|
||||
|
@@ -452,7 +452,7 @@ class bond(Addon, moduleBase):
|
||||
for s in removed_slave:
|
||||
try:
|
||||
runningslaves.remove(s)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
return runningslaves
|
||||
@@ -960,7 +960,7 @@ class bond(Addon, moduleBase):
|
||||
try:
|
||||
iface_attrs.remove("es-sys-mac")
|
||||
self.logger.info("%s: non-root user can't check attribute \"es-sys-mac\" value" % ifaceobj.name)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
for attr in iface_attrs:
|
||||
|
@@ -815,7 +815,7 @@ class bridge(Bridge, moduleBase):
|
||||
module_name=self.__class__.__name__,
|
||||
attr="bridge_vni_per_svi_limit"
|
||||
))
|
||||
except:
|
||||
except Exception:
|
||||
self.bridge_vni_per_svi_limit = -1
|
||||
|
||||
@staticmethod
|
||||
@@ -947,7 +947,7 @@ class bridge(Bridge, moduleBase):
|
||||
for obj in ifaceobj_getfunc(intf):
|
||||
if obj.link_kind & ifaceLinkKind.BRIDGE:
|
||||
return obj.name
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
return None
|
||||
|
||||
@@ -2609,7 +2609,7 @@ class bridge(Bridge, moduleBase):
|
||||
for vlan_vni_map_entry in bridge_vlan_vni_map_entry.split():
|
||||
try:
|
||||
vlans_str, vni_str = utils.get_vlan_vni_in_map_entry(vlan_vni_map_entry)
|
||||
except:
|
||||
except Exception:
|
||||
return self.__warn_bridge_vlan_vni_map_syntax_error(vxlan_name, vlan_vni_map_entry)
|
||||
|
||||
# we need to convert vlan_str and vni_str back to a map {vlan: vni}
|
||||
@@ -3874,7 +3874,7 @@ class bridge(Bridge, moduleBase):
|
||||
for vlan_vni in bridge_vlan_vni_map_entry.split():
|
||||
try:
|
||||
vlans_str, vni_str = utils.get_vlan_vni_in_map_entry(vlan_vni)
|
||||
except:
|
||||
except Exception:
|
||||
fail = True
|
||||
self.__warn_bridge_vlan_vni_map_syntax_error(ifname, vlan_vni)
|
||||
continue
|
||||
@@ -3893,7 +3893,7 @@ class bridge(Bridge, moduleBase):
|
||||
|
||||
if vlan != cached_vnis[index] or vnis_list[i] != cached_vlans[index]:
|
||||
fail = True
|
||||
except:
|
||||
except Exception:
|
||||
fail = True
|
||||
|
||||
ifaceobjcurr.update_config_with_status("bridge-vlan-vni-map", bridge_vlan_vni_map_entry, fail)
|
||||
|
@@ -72,7 +72,7 @@ class vlan(Addon, moduleBase):
|
||||
try:
|
||||
if self._get_vlan_id(ifaceobj) != -1:
|
||||
return True
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
return False
|
||||
|
||||
|
@@ -1320,14 +1320,14 @@ class vxlan(Vxlan, moduleBase):
|
||||
for vni, ip in (vxlan_mcast_grp_map or {}).items():
|
||||
try:
|
||||
old_vxlan_remote_ip_map[vni].remove(ip)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
for vni, ips in old_vxlan_remote_ip_map.items():
|
||||
for ip in ips:
|
||||
try:
|
||||
self.iproute2.bridge_fdb_del_raw(ifaceobj.name, "00:00:00:00:00:00 dst %s src_vni %s" % (ip, vni))
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
|
@@ -345,7 +345,7 @@ class GvGen:
|
||||
try:
|
||||
props = node_or_link['properties']
|
||||
return props[key]
|
||||
except:
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
def propertyRemove(self, node_or_link, key):
|
||||
|
@@ -32,7 +32,7 @@ from datetime import date, datetime
|
||||
|
||||
try:
|
||||
from ifupdown2.ifupdown.utils import utils
|
||||
except:
|
||||
except ImportError:
|
||||
from ifupdown.utils import utils
|
||||
|
||||
|
||||
@@ -204,7 +204,7 @@ class LogManager:
|
||||
try:
|
||||
directory_to_remove = "%s/%s%s_%s" % (self.LOGGING_DIRECTORY, self.LOGGING_DIRECTORY_PREFIX, ifupdown2_log_dirs[index][0], ifupdown2_log_dirs[index][1])
|
||||
shutil.rmtree(directory_to_remove, ignore_errors=True)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
|
@@ -185,5 +185,5 @@ class IPv6Address(IPv6Network):
|
||||
def ip_address(ip):
|
||||
try:
|
||||
return IPv4Address(ip)
|
||||
except:
|
||||
except Exception:
|
||||
return IPv6Address(ip)
|
||||
|
@@ -53,7 +53,7 @@ def man_rst_body():
|
||||
|
||||
print (''' ifupdown2 addon modules add incremental functionality to
|
||||
core ifupdown2 tool.
|
||||
|
||||
|
||||
All installed addon modules are executed on every interface
|
||||
listed in the interfaces file. Addon modules are installed under
|
||||
/usr/share/ifupdownaddons. To see the list of active addon
|
||||
@@ -85,13 +85,13 @@ def get_addon_modinfo(modules_dir):
|
||||
try:
|
||||
m = __import__(mname)
|
||||
mclass = getattr(m, mname)
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
continue
|
||||
minstance = mclass()
|
||||
if hasattr(minstance, 'get_modinfo'):
|
||||
modinfo[mname] = minstance.get_modinfo()
|
||||
except:
|
||||
except Exception:
|
||||
raise
|
||||
|
||||
return modinfo
|
||||
@@ -233,7 +233,7 @@ def process_move_cmd(args):
|
||||
pos = int(args.position)
|
||||
if pos < 0 or pos > len(addon_config.get(op)):
|
||||
raise Exception('invalid value for position')
|
||||
except:
|
||||
except Exception:
|
||||
raise
|
||||
|
||||
if addon_config[op].index(module) == pos:
|
||||
|
Reference in New Issue
Block a user