1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fix apache2_module a2enmod/a2dismod detection and error message if not found. (#3258)

This commit is contained in:
Felix Fontein 2021-08-25 06:36:19 +02:00 committed by GitHub
parent 1ca9c35010
commit f2fa56b485
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- "apache2_module - fix ``a2enmod``/``a2dismod`` detection, and error message when not found (https://github.com/ansible-collections/community.general/issues/3253)."

View file

@ -202,15 +202,17 @@ def _set_state(module, state):
result=success_msg, result=success_msg,
warnings=module.warnings) warnings=module.warnings)
a2mod_binary = [module.get_bin_path(a2mod_binary)] a2mod_binary_path = module.get_bin_path(a2mod_binary)
if a2mod_binary is None: if a2mod_binary_path is None:
module.fail_json(msg="%s not found. Perhaps this system does not use %s to manage apache" % (a2mod_binary, a2mod_binary)) module.fail_json(msg="%s not found. Perhaps this system does not use %s to manage apache" % (a2mod_binary, a2mod_binary))
a2mod_binary_cmd = [a2mod_binary_path]
if not want_enabled and force: if not want_enabled and force:
# force exists only for a2dismod on debian # force exists only for a2dismod on debian
a2mod_binary.append('-f') a2mod_binary_cmd.append('-f')
result, stdout, stderr = module.run_command(a2mod_binary + [name]) result, stdout, stderr = module.run_command(a2mod_binary_cmd + [name])
if _module_is_enabled(module) == want_enabled: if _module_is_enabled(module) == want_enabled:
module.exit_json(changed=True, module.exit_json(changed=True,