Remove try block from privileged ip_lib module
It was marked that this try..except.. block can be removed when we will be using pyroute2 >= 0.5.13. Now we have 0.5.13 in the lower-constraints already so it's time to remove it. Change-Id: Ic15361e34a2a9c371954d2f0851d230b8f9feb1f
This commit is contained in:
parent
47eecd9b67
commit
8d44265736
|
@ -241,12 +241,7 @@ def _translate_ip_device_exception(e, device=None, namespace=None):
|
||||||
|
|
||||||
def get_link_id(device, namespace, raise_exception=True):
|
def get_link_id(device, namespace, raise_exception=True):
|
||||||
with get_iproute(namespace) as ip:
|
with get_iproute(namespace) as ip:
|
||||||
# TODO(ralonsoh): remove try block when the mininimum pyroute2 version
|
link_id = ip.link_lookup(ifname=device)
|
||||||
# is >= 0.5.13
|
|
||||||
try:
|
|
||||||
link_id = ip.link_lookup(ifname=device)
|
|
||||||
except NetlinkError:
|
|
||||||
link_id = None
|
|
||||||
if not link_id or len(link_id) < 1:
|
if not link_id or len(link_id) < 1:
|
||||||
if raise_exception:
|
if raise_exception:
|
||||||
raise NetworkInterfaceNotFound(device=device, namespace=namespace)
|
raise NetworkInterfaceNotFound(device=device, namespace=namespace)
|
||||||
|
|
Loading…
Reference in New Issue