mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
now returns fatal error if operation on selinux enabled target is
attempted w/o selinux python bindings Signed-off-by: Brian Coca <briancoca+dev@gmail.com>
This commit is contained in:
parent
c3a8b6ff07
commit
98cc29f9fd
1 changed files with 5 additions and 0 deletions
|
@ -265,6 +265,11 @@ class AnsibleModule(object):
|
|||
|
||||
def selinux_enabled(self):
|
||||
if not HAVE_SELINUX:
|
||||
sestatus = get_bin_path('sestatus')
|
||||
if sestatus is not None:
|
||||
(rc,out,err) = run_command(sestatus)
|
||||
if rc == 0 and re.search('enabled', out):
|
||||
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…
Reference in a new issue