From 2cd6d3dbdf564d44b45e8f30b2ac90fa50acedc2 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 17 Jul 2017 17:38:41 +0200 Subject: [PATCH] library: ignore failure of ethtool to get permanent MAC address It's not uncommon that ethtool fails with: # ethtool -P dummy0 Cannot read permanent address: Operation not supported Ignore such errors. --- library/network_connections.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/library/network_connections.py b/library/network_connections.py index 333a8a2..38ae54a 100755 --- a/library/network_connections.py +++ b/library/network_connections.py @@ -316,7 +316,10 @@ class SysUtil: @staticmethod def _link_read_permaddress(ifname): - out = Util.check_output(['ethtool', '-P', ifname]) + try: + out = Util.check_output(['ethtool', '-P', ifname]) + except MyError as e: + return None import re m = re.match('^Permanent address: ([0-9A-Fa-f:]*)\n$', out) if not m: