Port seboolean to py3/py2.4 syntax (#3679)

reviewable/pr18780/r1
Michael Scherer 9 years ago committed by Toshio Kuratomi
parent c1e40b73f7
commit a62f088a24

@ -69,7 +69,7 @@ def has_boolean_value(module, name):
bools = [] bools = []
try: try:
rc, bools = selinux.security_get_boolean_names() rc, bools = selinux.security_get_boolean_names()
except OSError, e: except OSError:
module.fail_json(msg="Failed to get list of boolean names") module.fail_json(msg="Failed to get list of boolean names")
if name in bools: if name in bools:
return True return True
@ -80,7 +80,7 @@ def get_boolean_value(module, name):
state = 0 state = 0
try: try:
state = selinux.security_get_boolean_active(name) 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) module.fail_json(msg="Failed to determine current state for boolean %s" % name)
if state == 1: if state == 1:
return True return True
@ -138,7 +138,8 @@ def semanage_boolean_value(module, name, state):
semanage.semanage_disconnect(handle) semanage.semanage_disconnect(handle)
semanage.semanage_handle_destroy(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))) module.fail_json(msg="Failed to manage policy for boolean %s: %s" % (name, str(e)))
return True return True
@ -149,7 +150,7 @@ def set_boolean_value(module, name, state):
value = 1 value = 1
try: try:
rc = selinux.security_set_boolean(name, value) 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)) module.fail_json(msg="Failed to set boolean %s to %s" % (name, value))
if rc == 0: if rc == 0:
return True return True

Loading…
Cancel
Save