Using get_bin_path to find rmmod and modprobe

reviewable/pr18780/r1
Robert Osowiecki 10 years ago
parent 764a0e26b6
commit 4ffb5f065b

@ -97,13 +97,13 @@ def main():
# Add/remove module as needed # Add/remove module as needed
if args['state'] == 'present': if args['state'] == 'present':
if not present: if not present:
rc, _, err = module.run_command(['modprobe', args['name'], args['params']]) rc, _, err = module.run_command([module.get_bin_path('modprobe', True), args['name'], args['params']])
if rc != 0: if rc != 0:
module.fail_json(msg=err, **args) module.fail_json(msg=err, **args)
args['changed'] = True args['changed'] = True
elif args['state'] == 'absent': elif args['state'] == 'absent':
if present: if present:
rc, _, err = module.run_command(['rmmod', args['name']]) rc, _, err = module.run_command([module.get_bin_path('rmmod', True), args['name']])
if rc != 0: if rc != 0:
module.fail_json(msg=err, **args) module.fail_json(msg=err, **args)
args['changed'] = True args['changed'] = True

Loading…
Cancel
Save