Remove a bare raise noticed by the linter
There is a bare raise in a function that is used as an exception handler. Remove it and have the caller raise inside it's except block instead. Change-Id: Ib494d320e1c2e6cc6daa20255e30291fc2e258e8 Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
parent
cf463cce43
commit
a8e8f88cde
|
@ -157,12 +157,11 @@ def _get_iproute(namespace):
|
|||
|
||||
|
||||
def _translate_ip_device_exception(e, device=None, namespace=None):
|
||||
if e.code == errno.ENODEV:
|
||||
raise NetworkInterfaceNotFound(device=device, namespace=namespace)
|
||||
if e.code == errno.EOPNOTSUPP:
|
||||
raise InterfaceOperationNotSupported(device=device,
|
||||
namespace=namespace)
|
||||
raise
|
||||
if e.code == errno.ENODEV:
|
||||
raise NetworkInterfaceNotFound(device=device, namespace=namespace)
|
||||
if e.code == errno.EOPNOTSUPP:
|
||||
raise InterfaceOperationNotSupported(device=device,
|
||||
namespace=namespace)
|
||||
|
||||
|
||||
def _get_link_id(device, namespace):
|
||||
|
@ -180,6 +179,7 @@ def _run_iproute_link(command, device, namespace=None, **kwargs):
|
|||
return ip.link(command, index=idx, **kwargs)
|
||||
except NetlinkError as e:
|
||||
_translate_ip_device_exception(e, device, namespace)
|
||||
raise
|
||||
except OSError as e:
|
||||
if e.errno == errno.ENOENT:
|
||||
raise NetworkNamespaceNotFound(netns_name=namespace)
|
||||
|
@ -193,6 +193,7 @@ def _run_iproute_neigh(command, device, namespace, **kwargs):
|
|||
return ip.neigh(command, ifindex=idx, **kwargs)
|
||||
except NetlinkError as e:
|
||||
_translate_ip_device_exception(e, device, namespace)
|
||||
raise
|
||||
except OSError as e:
|
||||
if e.errno == errno.ENOENT:
|
||||
raise NetworkNamespaceNotFound(netns_name=namespace)
|
||||
|
@ -206,6 +207,7 @@ def _run_iproute_addr(command, device, namespace, **kwargs):
|
|||
return ip.addr(command, index=idx, **kwargs)
|
||||
except NetlinkError as e:
|
||||
_translate_ip_device_exception(e, device, namespace)
|
||||
raise
|
||||
except OSError as e:
|
||||
if e.errno == errno.ENOENT:
|
||||
raise NetworkNamespaceNotFound(netns_name=namespace)
|
||||
|
|
Loading…
Reference in New Issue