When ethtool fails to find a driver for some reason lnst-slave fails with a
"AttributeError: 'NoneType' object has no attribute 'group'"
exception. This
should be handled gracefully.
This might happen for example on 2.6.32-431.*.el6 kernels probably due to a kernel
bug: the kernel sends a RTM_DELLINK message and right after that a RTM_NEWLINK
for the same device which triggers device.init_netlink() call and a driver
query for a missing device.
Signed-off-by: Artem Savkov <asavkov(a)redhat.com>
---
lnst/Slave/InterfaceManager.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lnst/Slave/InterfaceManager.py b/lnst/Slave/InterfaceManager.py
index 01b23e5..b014c6b 100644
--- a/lnst/Slave/InterfaceManager.py
+++ b/lnst/Slave/InterfaceManager.py
@@ -498,7 +498,7 @@ class Device(object):
return 'loopback'
out, _ = exec_cmd("ethtool -i %s" % self._name, False, False, False)
match = re.search("^driver: (.*)$", out, re.MULTILINE)
- return match.group(1)
+ return match.group(1) if match else None
def get_if_data(self):
if_data = {"devname": self._name,
--
2.1.0
Show replies by date