mirror of
https://github.com/ansible-collections/ansible.posix.git
synced 2026-01-10 22:55:27 +01:00
respawn firewalld_info module when selinux is missing
This commit is contained in:
parent
ad414c87b4
commit
85c958ccb8
2 changed files with 9 additions and 0 deletions
|
|
@ -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)."
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Reference in a new issue