respawn firewalld_info module when selinux is missing

This commit is contained in:
Maxwell G 2023-05-13 19:51:57 +00:00
parent ad414c87b4
commit 85c958ccb8
No known key found for this signature in database
GPG key ID: F79E4E25E8C661F8
2 changed files with 9 additions and 0 deletions

View file

@ -6,3 +6,5 @@ minor_changes:
(https://github.com/ansible-collections/ansible.posix/pull/460)."
- "firewalld - respawn module to use the system python interpreter when the ``firewall`` python module is not available for ``ansible_python_interpreter``
(https://github.com/ansible-collections/ansible.posix/pull/460)."
- "firewalld_info - respawn module to use the system python interpreter when the ``firewall`` python module is not available for ``ansible_python_interpreter``
(https://github.com/ansible-collections/ansible.posix/pull/460)."

View file

@ -211,6 +211,7 @@ firewalld_info:
from ansible.module_utils.basic import AnsibleModule, missing_required_lib
from ansible.module_utils._text import to_native
from ansible_collections.ansible.posix.plugins.module_utils._respawn import respawn_module, HAS_RESPAWN_UTIL
from ansible_collections.ansible.posix.plugins.module_utils.version import StrictVersion
@ -322,6 +323,12 @@ def main():
)
# Exit with failure message if requirements modules are not installed.
if not HAS_DBUS and not HAS_FIREWALLD and HAS_RESPAWN_UTIL:
# Only respawn the module if both libraries are missing.
# If only one is available, then usage of the "wrong" (i.e. not the system one)
# python interpreter is likely not the problem.
respawn_module("firewall")
if not HAS_DBUS:
module.fail_json(msg=missing_required_lib('python-dbus'))
if not HAS_FIREWALLD: