From f4c4537327f237dc84a525e9e59514a869ee84d3 Mon Sep 17 00:00:00 2001 From: Dag Wieers Date: Wed, 24 Oct 2012 17:51:15 +0200 Subject: [PATCH] Resolve traceback when python-selinux is not installed --- library/selinux | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/library/selinux b/library/selinux index ee4a3cbb43b..e110cb1eaa1 100755 --- a/library/selinux +++ b/library/selinux @@ -57,9 +57,9 @@ import re try: import selinux - HAVE_SELINUX=True except ImportError: - HAVE_SELINUX=False + print "failed=True msg='python-selinux required for this module'" + sys.exit(1) # getter subroutines def get_config_state(configfile): @@ -117,8 +117,6 @@ def set_config_policy(policy, configfile): myfile.close() def main(): - if (not HAVE_SELINUX): - module.fail_json(msg='python-selinux required for this module') module = AnsibleModule( argument_spec = dict(