use module.get_bin_path() for a2enmod

This commit is contained in:
Christian Berendt 2013-11-25 12:50:22 +01:00 committed by Michael DeHaan
parent a500f63766
commit 5b8cdf6ce2

View file

@ -45,7 +45,8 @@ EXAMPLES = '''
def _module_is_enabled(module): def _module_is_enabled(module):
name = module.params['name'] name = module.params['name']
result, stdout, stderr = module.run_command("a2enmod -q %s" % name) a2enmod_binary = module.get_bin_path("a2enmod")
result, stdout, stderr = module.run_command("%s -q %s" % (a2enmod_binary, name))
return result == 0 return result == 0
def _module_is_disabled(module): def _module_is_disabled(module):
@ -69,7 +70,8 @@ def _enable_module(module):
if _module_is_enabled(module): if _module_is_enabled(module):
module.exit_json(changed = False, result = "Success") module.exit_json(changed = False, result = "Success")
result, stdout, stderr = module.run_command("a2enmod %s" % name) a2enmod_binary = module.get_bin_path("a2enmod")
result, stdout, stderr = module.run_command("%s %s" % (a2enmod_binary, name))
if result != 0: if result != 0:
module.fail_json(msg="Failed to enable module %s: %s" % (name, stdout)) module.fail_json(msg="Failed to enable module %s: %s" % (name, stdout))