commit 745ad9442c448e5f165f5168ac0e99acf77ba132
Author: Jan Tluka <jtluka(a)redhat.com>
Date: Wed Jun 27 16:02:25 2012 +0200
Use modinfo instead of deprecated modprobe
Since modprobe -l is deprecated and modinfo should be used instead
I made the update to type_check method.
I have tested it on RHEL5 and RHEL6. On RHEL5 I've hit another issue
on macvlan check. The module is not available on RHEL5 and the slave
instance failed due to die_on_err=True (default). I changed this to
False since we might have cases when the module for a network device
is not available.
NetConfig/NetConfigDevice.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/NetConfig/NetConfigDevice.py b/NetConfig/NetConfigDevice.py
index be8e673..8e89c36 100644
--- a/NetConfig/NetConfigDevice.py
+++ b/NetConfig/NetConfigDevice.py
@@ -68,7 +68,7 @@ class NetConfigDeviceGeneric:
@classmethod
def type_check(self):
if self._modulename:
- output = exec_cmd("modprobe -l %s" % self._modulename)[0]
+ output = exec_cmd("modinfo -F filename %s" % self._modulename,
die_on_err=False)[0]
for line in output.split("\n"):
if re.match(r'^.*\/%s\.ko$' % self._modulename, line):
return True
Show replies by date