ISSUE TYPE
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).
ISSUE TYPE
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
fails if it is a boolean, so I now have to rewrite this as:
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).