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
--
1.7.6.5
Show replies by date