From 04399a6e724c95c44e136f4675b04262de73d156 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 8 Sep 2019 20:04:45 +0200 Subject: Python/ifconfig: T1557: mac: ignore empty address strings --- python/vyos/ifconfig.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'python/vyos') diff --git a/python/vyos/ifconfig.py b/python/vyos/ifconfig.py index 9310ee278..ab8799e54 100644 --- a/python/vyos/ifconfig.py +++ b/python/vyos/ifconfig.py @@ -43,7 +43,6 @@ dhclient_base = r'/var/lib/dhcp/dhclient_' class Interface: - def __init__(self, ifname, type=None): """ This is the base interface class which supports basic IP/MAC address @@ -202,6 +201,10 @@ class Interface: >>> Interface('eth0').mac '00:90:43:fe:fe:1b' """ + # on interface removal (ethernet) an empty string is passed - ignore it + if not mac: + return None + # a mac address consits out of 6 octets octets = len(mac.split(':')) if octets != 6: -- cgit v1.2.3