mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-24 09:59:08 -07:00
Merge pull request #1438 from dagwieers/selinux-module-fix
Resolve traceback when python-selinux is not installed
This commit is contained in:
commit
2dd6ee5f70
1 changed files with 2 additions and 4 deletions
|
@ -57,9 +57,9 @@ import re
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import selinux
|
import selinux
|
||||||
HAVE_SELINUX=True
|
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAVE_SELINUX=False
|
print "failed=True msg='python-selinux required for this module'"
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
# getter subroutines
|
# getter subroutines
|
||||||
def get_config_state(configfile):
|
def get_config_state(configfile):
|
||||||
|
@ -117,8 +117,6 @@ def set_config_policy(policy, configfile):
|
||||||
myfile.close()
|
myfile.close()
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
if (not HAVE_SELINUX):
|
|
||||||
module.fail_json(msg='python-selinux required for this module')
|
|
||||||
|
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec = dict(
|
argument_spec = dict(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue