From a62f088a2487254686afa178bcd46fe9ec96cc70 Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Tue, 17 May 2016 19:23:07 +0200 Subject: [PATCH] Port seboolean to py3/py2.4 syntax (#3679) --- system/seboolean.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/system/seboolean.py b/system/seboolean.py index 3a150d05a20..1fbb83f2a7d 100644 --- a/system/seboolean.py +++ b/system/seboolean.py @@ -69,7 +69,7 @@ def has_boolean_value(module, name): bools = [] try: rc, bools = selinux.security_get_boolean_names() - except OSError, e: + except OSError: module.fail_json(msg="Failed to get list of boolean names") if name in bools: return True @@ -80,7 +80,7 @@ def get_boolean_value(module, name): state = 0 try: state = selinux.security_get_boolean_active(name) - except OSError, e: + except OSError: module.fail_json(msg="Failed to determine current state for boolean %s" % name) if state == 1: return True @@ -138,7 +138,8 @@ def semanage_boolean_value(module, name, state): semanage.semanage_disconnect(handle) semanage.semanage_handle_destroy(handle) - except Exception, e: + except Exception: + e = get_exception() module.fail_json(msg="Failed to manage policy for boolean %s: %s" % (name, str(e))) return True @@ -149,7 +150,7 @@ def set_boolean_value(module, name, state): value = 1 try: rc = selinux.security_set_boolean(name, value) - except OSError, e: + except OSError: module.fail_json(msg="Failed to set boolean %s to %s" % (name, value)) if rc == 0: return True