mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-14 21:01:13 +00:00
selinux: check if policy exists before switching (#31834)
* selinux: check if policy exists before switching * Check the policy dir
This commit is contained in:
@@ -151,6 +151,9 @@ def set_state(module, state):
|
||||
|
||||
|
||||
def set_config_policy(module, policy, configfile):
|
||||
if not os.path.exists('/etc/selinux/%s/policy' % policy):
|
||||
module.fail_json(msg='Policy %s does not exist in /etc/selinux/' % policy)
|
||||
|
||||
# edit config file with state value
|
||||
# SELINUXTYPE=targeted
|
||||
policyline = 'SELINUXTYPE=%s' % policy
|
||||
|
||||
Reference in New Issue
Block a user