mirror of
https://github.com/ansible-collections/ansible.posix.git
synced 2026-07-31 20:04:50 +00:00
respawn selinux module when selinux is missing
This commit is contained in:
@@ -2,3 +2,5 @@
|
|||||||
minor_changes:
|
minor_changes:
|
||||||
- "seboolean - respawn module to use the system python interpreter when the ``selinux`` python module is not available for ``ansible_python_interpreter``
|
- "seboolean - respawn module to use the system python interpreter when the ``selinux`` python module is not available for ``ansible_python_interpreter``
|
||||||
(https://github.com/ansible-collections/ansible.posix/pull/460)."
|
(https://github.com/ansible-collections/ansible.posix/pull/460)."
|
||||||
|
- "selinux - respawn module to use the system python interpreter when the ``selinux`` python module is not available for ``ansible_python_interpreter``
|
||||||
|
(https://github.com/ansible-collections/ansible.posix/pull/460)."
|
||||||
|
|||||||
@@ -107,6 +107,8 @@ from ansible.module_utils.basic import AnsibleModule, missing_required_lib
|
|||||||
from ansible.module_utils.common.process import get_bin_path
|
from ansible.module_utils.common.process import get_bin_path
|
||||||
from ansible.module_utils.facts.utils import get_file_lines
|
from ansible.module_utils.facts.utils import get_file_lines
|
||||||
|
|
||||||
|
from ansible_collections.ansible.posix.plugins.module_utils._respawn import respawn_module, HAS_RESPAWN_UTIL
|
||||||
|
|
||||||
|
|
||||||
# getter subroutines
|
# getter subroutines
|
||||||
def get_config_state(configfile):
|
def get_config_state(configfile):
|
||||||
@@ -236,6 +238,8 @@ def main():
|
|||||||
)
|
)
|
||||||
|
|
||||||
if not HAS_SELINUX:
|
if not HAS_SELINUX:
|
||||||
|
if HAS_RESPAWN_UTIL:
|
||||||
|
respawn_module("selinux")
|
||||||
module.fail_json(msg=missing_required_lib('libselinux-python'), exception=SELINUX_IMP_ERR)
|
module.fail_json(msg=missing_required_lib('libselinux-python'), exception=SELINUX_IMP_ERR)
|
||||||
|
|
||||||
# global vars
|
# global vars
|
||||||
|
|||||||
Reference in New Issue
Block a user