mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #23619 from jfindlay/fix_kmod_state
fix kmod.present processing of module loading
This commit is contained in:
commit
7df3579bbc
1 changed files with 11 additions and 9 deletions
|
@ -57,18 +57,20 @@ def present(name, persist=False):
|
|||
ret['comment'] = 'Kernel module {0} is unavailable'.format(name)
|
||||
ret['result'] = False
|
||||
return ret
|
||||
for mod in __salt__['kmod.load'](name, persist):
|
||||
if not mod:
|
||||
# It's compiled into the kernel
|
||||
ret['comment'] = 'Kernel module {0} is compiled in'.format(name)
|
||||
|
||||
load_result = __salt__['kmod.load'](name, persist)
|
||||
if isinstance(load_result, list):
|
||||
if len(load_result) > 0:
|
||||
for mod in load_result:
|
||||
ret['changes'][mod] = 'loaded'
|
||||
ret['comment'] = 'Loaded kernel module {0}'.format(name)
|
||||
return ret
|
||||
else:
|
||||
ret['changes'][mod] = 'loaded'
|
||||
if not ret['changes']:
|
||||
ret['result'] = False
|
||||
ret['comment'] = 'Failed to load kernel module {0}'.format(name)
|
||||
else:
|
||||
ret['result'] = False
|
||||
ret['comment'] = 'Failed to load kernel module {0}'.format(name)
|
||||
return ret
|
||||
ret['comment'] = 'Loaded kernel module {0}'.format(name)
|
||||
ret['comment'] = load_result
|
||||
return ret
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue