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

setup defines ansible_selinux as a boolean or as a dict #18692

Closed
dagwieers opened this issue Nov 30, 2016 · 7 comments
Closed

setup defines ansible_selinux as a boolean or as a dict #18692

dagwieers opened this issue Nov 30, 2016 · 7 comments
Assignees
Labels
affects_2.2 This issue/PR affects Ansible v2.2 affects_2.3 This issue/PR affects Ansible v2.3 affects_2.4 This issue/PR affects Ansible v2.4 bug This issue/PR relates to a bug. c:module_utils/facts selinux

Comments

@dagwieers
Copy link
Contributor

dagwieers commented Nov 30, 2016

ISSUE TYPE
  • Bug Report
COMPONENT NAME

setup / facts

ANSIBLE VERSION

v2.2 and older

SUMMARY

Looking at the code https://github.com/ansible/ansible/blob/devel/lib/ansible/module_utils/facts.py#L420 it defines ansible_selinux either as a boolean (False) when HAVE_SELINUX is False, but as a dictionary when HAVE_SELINUX is True.

That is bad design, it makes it harder to test for specific properties.
https://github.com/ansible/ansible/pull/18690/files#diff-6ef0fa8be07ffd2967bf772e9d792339R20

when: ansible_selinux is defined and ansible_selinux.status == 'enabled'

fails if it is a boolean, so I now have to rewrite this as:

when: ansible_selinux is defined and ansible_selinux != False and ansible_selinux.status == 'enabled'

and I won't be certain that this will not fail in some weird way (like maybe on some platform it returns True instead of a dictionary with status key).

@ansibot
Copy link
Contributor

ansibot commented Dec 1, 2016

@dagwieers: Thanks for taking the time to open this issue, but it was filed under the wrong github repository. Please create a new issue at https://github.com/ansible/ansible-modules-core/issues
click here for bot help

@ansibot ansibot closed this as completed Dec 1, 2016
@dagwieers
Copy link
Contributor Author

dagwieers commented Dec 1, 2016

@ansibot You are quite wrong, this is part of ansible/ansible. Oh, why am I talking to a bot :-)

EDIT: remove broken command -jctanner

@sivel
Copy link
Member

sivel commented Dec 1, 2016

bot_skip

@sivel sivel reopened this Dec 1, 2016
@sivel
Copy link
Member

sivel commented Dec 1, 2016

Some of this was discussed in short in a core meeting, although from a slightly different topic.

Ref: https://meetbot-raw.fedoraproject.org/ansible-meeting/2016-09-01/public_core_meeting.2016-09-01-15.09.log.html

@dagwieers
Copy link
Contributor Author

@sivel Thanks for the pointer !

However what was concluded does not seem to be implemented. (I haven't seen the output in the Shippable console). Is this somewhere on a TODO list ? Something I could be working on maybe ?

@ansibot ansibot added the bot_broken The bot is misbehaving. NOT for failing CI. A staff member will investigate. label Dec 1, 2016
@abadger
Copy link
Contributor

abadger commented Dec 1, 2016

@Trozz was there any new information on #16612 ? This ticket is diving into similar areas.

@jctanner jctanner added bug_report and removed bot_broken The bot is misbehaving. NOT for failing CI. A staff member will investigate. labels Dec 1, 2016
@ansibot ansibot added affects_2.2 This issue/PR affects Ansible v2.2 module This issue/PR relates to a module. plugin and removed module This issue/PR relates to a module. plugin labels Dec 13, 2016
@calfonso calfonso added affects_2.3 This issue/PR affects Ansible v2.3 affects_2.4 This issue/PR affects Ansible v2.4 labels Sep 28, 2017
@samdoran
Copy link
Contributor

samdoran commented Oct 5, 2017

Fixed in #31065.

Cherry-picked for inclusion in 2.4.1.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.2 This issue/PR affects Ansible v2.2 affects_2.3 This issue/PR affects Ansible v2.3 affects_2.4 This issue/PR affects Ansible v2.4 bug This issue/PR relates to a bug. c:module_utils/facts selinux
Projects
None yet
Development

No branches or pull requests

8 participants