On Fri, Jul 19, 2019 at 01:36:46PM +0200, csfakian(a)redhat.com wrote:
From: Christos Sfakianakis <csfakian(a)redhat.com>
Return None in case realdev has not been set.
Signed-off-by: Christos Sfakianakis <csfakian(a)redhat.com>
---
lnst/Devices/VxlanDevice.py | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/lnst/Devices/VxlanDevice.py b/lnst/Devices/VxlanDevice.py
index c317913..3129bf3 100644
--- a/lnst/Devices/VxlanDevice.py
+++ b/lnst/Devices/VxlanDevice.py
@@ -43,9 +43,11 @@ class VxlanDevice(SoftDevice):
def realdev(self):
if self._nl_msg is None:
return None
-
- if_id = int(self._get_linkinfo_data_attr("IFLA_VXLAN_LINK"))
- return self._if_manager.get_device(if_id)
+ try:
+ if_id = int(self._get_linkinfo_data_attr("IFLA_VXLAN_LINK"))
+ return self._if_manager.get_device(if_id)
+ except:
I think in this case we should handle just DeviceNotFound exceptions, so
we don't accidentaly hide some other error.
> + return None
>
> @realdev.setter
> def realdev(self, val):
> --
> 2.17.1
> _______________________________________________
> LNST-developers mailing list -- lnst-developers(a)lists.fedorahosted.org
> To unsubscribe send an email to lnst-developers-leave(a)lists.fedorahosted.org
> Fedora Code of Conduct:
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
> List Guidelines:
https://fedoraproject.org/wiki/Mailing_list_guidelines
> List Archives:
https://lists.fedorahosted.org/archives/list/lnst-developers@lists.fedora...