commit ceb8e2f5ab7ac26a2269d26624d3f02ca8def23e Author: Ondrej Lichtner olichtne@redhat.com Date: Fri Oct 31 08:58:10 2014 +0100
NetUtils: normalize_hwaddr works with strings only
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@redhat.com Signed-off-by: Jiri Pirko jiri@resnulli.us
lnst/Common/NetUtils.py | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) --- 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 = []
lnst-developers@lists.fedorahosted.org