From: Ondrej Lichtner <olichtne(a)redhat.com>
This patch fixes the behaviour of the normalize_hwaddr function when
nonstring parameter was passed. The function will nor return an empty
string in such cases.
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
lnst/Common/NetUtils.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lnst/Common/NetUtils.py b/lnst/Common/NetUtils.py
index 9563b3c..a578fb7 100644
--- a/lnst/Common/NetUtils.py
+++ b/lnst/Common/NetUtils.py
@@ -29,7 +29,10 @@ except ImportError:
from pyroute2.netlink.rtnl.ifinfmsg import ifinfmsg
def normalize_hwaddr(hwaddr):
- return hwaddr.upper().rstrip("\n")
+ try:
+ return hwaddr.upper().rstrip("\n")
+ except:
+ return ""
def scan_netdevs():
scan = []
--
1.9.3