mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 17:33:54 +00:00
Light cleanup of the kmod module
This commit is contained in:
parent
509c1aa789
commit
be4d74189b
@ -52,10 +52,10 @@ def available():
|
||||
for path in __salt__['cmd.run']('modprobe -l').split('\n'):
|
||||
bpath = os.path.basename(path)
|
||||
comps = bpath.split('.')
|
||||
if comps.count('ko'):
|
||||
if 'ko' in comps:
|
||||
# This is a kernel module, return it without the .ko extension
|
||||
ret.append('.'.join(comps[:comps.index('ko')]))
|
||||
return ret
|
||||
return sorted(list(ret))
|
||||
|
||||
|
||||
def check_available(mod):
|
||||
@ -66,10 +66,7 @@ def check_available(mod):
|
||||
|
||||
salt '*' kmod.check_available kvm
|
||||
'''
|
||||
if available().count(mod):
|
||||
# the module is available, return True
|
||||
return True
|
||||
return False
|
||||
return mod in available()
|
||||
|
||||
|
||||
def lsmod():
|
||||
@ -87,10 +84,11 @@ def lsmod():
|
||||
continue
|
||||
if comps[0] == 'Module':
|
||||
continue
|
||||
mdat = {}
|
||||
mdat['module'] = comps[0]
|
||||
mdat['size'] = comps[1]
|
||||
mdat['depcount'] = comps[2]
|
||||
mdat = {
|
||||
'size': comps[1],
|
||||
'module': comps[0],
|
||||
'depcount': comps[2],
|
||||
}
|
||||
if len(comps) > 3:
|
||||
mdat['deps'] = comps[3].split(',')
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user