mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-04 07:24:00 -07:00
[PR #10459/ee783066 backport][stable-11] Fix ansible-core 2.19 deprecations (#10471)
Fix ansible-core 2.19 deprecations (#10459)
Do not return warnings.
(cherry picked from commit ee7830667a
)
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
58803e62fe
commit
62e852f421
6 changed files with 21 additions and 28 deletions
|
@ -164,12 +164,12 @@ def _module_is_enabled(module):
|
|||
if module.params['ignore_configcheck']:
|
||||
if 'AH00534' in stderr and 'mpm_' in module.params['name']:
|
||||
if module.params['warn_mpm_absent']:
|
||||
module.warnings.append(
|
||||
module.warn(
|
||||
"No MPM module loaded! apache2 reload AND other module actions"
|
||||
" will fail if no MPM module is loaded immediately."
|
||||
)
|
||||
else:
|
||||
module.warnings.append(error_msg)
|
||||
module.warn(error_msg)
|
||||
return False
|
||||
else:
|
||||
module.fail_json(msg=error_msg)
|
||||
|
@ -224,9 +224,7 @@ def _set_state(module, state):
|
|||
|
||||
if _module_is_enabled(module) != want_enabled:
|
||||
if module.check_mode:
|
||||
module.exit_json(changed=True,
|
||||
result=success_msg,
|
||||
warnings=module.warnings)
|
||||
module.exit_json(changed=True, result=success_msg)
|
||||
|
||||
a2mod_binary_path = module.get_bin_path(a2mod_binary)
|
||||
if a2mod_binary_path is None:
|
||||
|
@ -241,9 +239,7 @@ def _set_state(module, state):
|
|||
result, stdout, stderr = module.run_command(a2mod_binary_cmd + [name])
|
||||
|
||||
if _module_is_enabled(module) == want_enabled:
|
||||
module.exit_json(changed=True,
|
||||
result=success_msg,
|
||||
warnings=module.warnings)
|
||||
module.exit_json(changed=True, result=success_msg)
|
||||
else:
|
||||
msg = (
|
||||
'Failed to set module {name} to {state}:\n'
|
||||
|
@ -261,9 +257,7 @@ def _set_state(module, state):
|
|||
stdout=stdout,
|
||||
stderr=stderr)
|
||||
else:
|
||||
module.exit_json(changed=False,
|
||||
result=success_msg,
|
||||
warnings=module.warnings)
|
||||
module.exit_json(changed=False, result=success_msg)
|
||||
|
||||
|
||||
def main():
|
||||
|
@ -279,8 +273,6 @@ def main():
|
|||
supports_check_mode=True,
|
||||
)
|
||||
|
||||
module.warnings = []
|
||||
|
||||
name = module.params['name']
|
||||
if name == 'cgi' and _run_threaded(module):
|
||||
module.fail_json(msg="Your MPM seems to be threaded. No automatic actions on module cgi possible.")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue