mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-08-23 06:21:43 -07:00
Merge pull request #3582 from bcoca/fail_if_selinux_and_missing_bindings
fatal if target selinux and missing bindings
This commit is contained in:
commit
7a759e6396
1 changed files with 5 additions and 0 deletions
|
@ -265,6 +265,11 @@ class AnsibleModule(object):
|
|||
|
||||
def selinux_enabled(self):
|
||||
if not HAVE_SELINUX:
|
||||
seenabled = get_bin_path('selinuxenabled')
|
||||
if seenabled is not None:
|
||||
(rc,out,err) = run_command(seenabled)
|
||||
if rc == 0:
|
||||
self.fail_json(msg="Aborting, target uses selinux but python bindings (python-selinux) aren't installed!")
|
||||
return False
|
||||
if selinux.is_selinux_enabled() == 1:
|
||||
return True
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue