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) (#3263)

(cherry picked from commit f2fa56b485)

Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
patchback[bot] 2021-08-25 07:06:23 +02:00 committed by GitHub
parent e01d014c36
commit b9aab568f7
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,
warnings=module.warnings)
a2mod_binary = [module.get_bin_path(a2mod_binary)]
if a2mod_binary is None:
a2mod_binary_path = module.get_bin_path(a2mod_binary)
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))
a2mod_binary_cmd = [a2mod_binary_path]
if not want_enabled and force:
# 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:
module.exit_json(changed=True,