mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 20:01:25 -07: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:
parent
452028ab7d
commit
0592fd47bc
2 changed files with 40 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue