Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workaround python-libselinux API change #25685

Merged
merged 1 commit into from
Jul 21, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/ansible/modules/system/seboolean.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,12 @@ def has_boolean_value(module, name):
rc, bools = selinux.security_get_boolean_names()
except OSError:
module.fail_json(msg="Failed to get list of boolean names")
if to_bytes(name) in bools:
# work around for selinux who changed its API, see
# https://github.com/ansible/ansible/issues/25651
if len(bools) > 0:
if isinstance(bools[0], binary_type):
name = to_bytes(name)
if name in bools:
return True
else:
return False
Expand Down Expand Up @@ -224,6 +229,7 @@ def main():
# import module snippets
from ansible.module_utils.basic import *
from ansible.module_utils._text import to_bytes
from ansible.module_utils.six import binary_type

if __name__ == '__main__':
main()