The bug this patch fixes is already tracked in this issue:
https://github.com/jpirko/lnst/issues/132
And I already have a fix ready in my repository which I'll be submitting
either tomorrow or next week.
Thanks for the patch anyway, in my patch I return "" but now that I see
your solution I'll probably tweak it to return None instead.
-Ondrej
On Thu, Jul 16, 2015 at 05:26:37PM +0200, Artem Savkov wrote:
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
_______________________________________________
LNST-developers mailing list
LNST-developers(a)lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/lnst-developers