-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
apache2_module generates false/misleading warning (#5793)
* Add parameter warn_mpm_module to control when warning are raised * Remoe whitespace * Add changelog fragment * Add missing license * Update changelogs/fragments/5793-apache2-module-npm-warnings.yml Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/apache2_module.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/apache2_module.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update tests/integration/targets/apache2_module/tasks/635-apache2-misleading-warning.yml Co-authored-by: Felix Fontein <felix@fontein.de> * Refining integration test - previous was invalid * False to false * refactor assertion for suse * Revert "refactor assertion for suse" This reverts commit 61b86e7. * Excluding test on Suse Co-authored-by: Felix Fontein <felix@fontein.de> (cherry picked from commit 756c077)
- Loading branch information
1 parent
16c7615
commit c5c11d7
Showing
5 changed files
with
79 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
minor_changes: | ||
- apache2_module - add module argument ``warn_mpm_absent`` to control whether warning are raised in some edge cases (https://github.com/ansible-collections/community.general/pull/5793). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
tests/integration/targets/apache2_module/tasks/635-apache2-misleading-warning.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
--- | ||
# Copyright (c) Ansible Project | ||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt) | ||
# SPDX-License-Identifier: GPL-3.0-or-later | ||
# This test represent the misleading behavior of the following issue: https://github.com/ansible-collections/community.general/issues/635 | ||
- name: Disable MPM event module | ||
apache2_module: | ||
name: "{{ item.module}}" | ||
state: "{{ item.state}}" | ||
ignore_configcheck: true | ||
register: disable_mpm_modules | ||
with_items: | ||
- { module: mpm_event, state: absent } | ||
- { module: mpm_prefork, state: present } | ||
|
||
- assert: | ||
that: | ||
- "'warnings' in disable_mpm_modules" | ||
- disable_mpm_modules["warnings"] == [ | ||
"No MPM module loaded! apache2 reload AND other module actions will fail if no MPM module is loaded immediately.", | ||
"No MPM module loaded! apache2 reload AND other module actions will fail if no MPM module is loaded immediately." | ||
] | ||
|
||
- name: Enable MPM event module - Revert previous change | ||
apache2_module: | ||
name: "{{ item.module}}" | ||
state: "{{ item.state}}" | ||
ignore_configcheck: true | ||
register: disable_mpm_modules | ||
with_items: | ||
- { module: mpm_prefork, state: absent } | ||
- { module: mpm_event, state: present } | ||
|
||
- name: Disable MPM event module | ||
apache2_module: | ||
name: "{{ item.module}}" | ||
state: "{{ item.state}}" | ||
ignore_configcheck: true | ||
warn_mpm_absent: false | ||
register: disable_mpm_modules | ||
with_items: | ||
- { module: mpm_event, state: absent } | ||
- { module: mpm_prefork, state: present } | ||
|
||
- assert: | ||
that: | ||
- "'warnings' not in disable_mpm_modules" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters