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

SELINUX_Works is of type <type 'str'> and we were unable to convert to bool #1313

Open
mlaurent205 opened this issue Nov 12, 2024 · 10 comments
Labels

Comments

@mlaurent205
Copy link

AWS
Ubuntu 18.04.6 LTS (GNU/Linux 4.15.0-189-generic x86_64) and
Ubuntu 18.04.6 LTS (GNU/Linux 5.4.0-1135-aws x86_64)

TASK [freeipa.ansible_freeipa.ipaclient : Install - Create IPA NSS database] *******************************************
Tuesday 12 November 2024 09:44:27 -0600 (0:00:00.034) 0:00:26.251 ******
fatal: [aws-freeipa-ubuntu-staging-1804.wpnops.cloud]: FAILED! => {"changed": false, "msg": "argument 'selinux_works' is of type <type 'str'> and we were unable to convert to bool: The value '' is not a valid boolean. Valid booleans include: 0, 'on', 'f', 'false', 1, 'no', 'n', '1', '0', 't', 'y', 'off', 'yes', 'true'"}

@rjeffman
Copy link
Member

rjeffman commented Dec 3, 2024

The error seems to be on your playbook, as this message is generated by Ansible when it evaluates arguments.

selinux_works is defined as a bool, and used as a bool in the code.

Do you have selinux_works: '' (or with anything that evals to an empty string) on your playbook?

@mlaurent205
Copy link
Author

mlaurent205 commented Dec 3, 2024 via email

@rjeffman
Copy link
Member

rjeffman commented Dec 3, 2024

Both on ansible-freeipa and on FreeIPA the only values this variable receives is True or False, as the variable holds a boolean value.

We need more info to have any clue on what is going on.

@mlaurent205
Copy link
Author

mlaurent205 commented Dec 3, 2024 via email

@t-woerner
Copy link
Member

t-woerner commented Dec 4, 2024

The ipaclient_test module is using tasks.check_selinux_status() imported from ipaplatform.
It seems that check_selinux_status is not implemented for debian.

https://github.com/freeipa/ansible-freeipa/blob/master/roles/ipaclient/library/ipaclient_test.py#L538

There should be an additional try and except to catch this case.

@t-woerner t-woerner added the bug label Dec 4, 2024
@rjeffman
Copy link
Member

rjeffman commented Dec 4, 2024

It's interesting that it seems to work fine on Ubundu 20.04, 24.04, and Debian 11.

@t-woerner
Copy link
Member

Is there a patch for ipaplatform/debian added?

@rjeffman
Copy link
Member

rjeffman commented Dec 4, 2024

Not from my side. I haven't looked at the Ubuntu/Debian packages.

@t-woerner
Copy link
Member

t-woerner commented Dec 4, 2024

This is an issue for older IPA releases if selinux is not enabled as check_selinux_status does not return a bool value.

ipaplatform/redhat/tasks.py:

    def check_selinux_status(self, restorecon=paths.RESTORECON):
        if not selinux_enabled():
            return
        if not os.path.exists(restorecon):
            raise RuntimeError('SELinux is enabled but %s does not exist.\n'
                               'Install the policycoreutils package and start '
                               'the installation again.' % restorecon)

ipaplatform/debian/tasks.py

class DebianTaskNamespace(RedHatTaskNamespace):

@rjeffman
Copy link
Member

rjeffman commented Dec 4, 2024

The issue happens on any FreeIPA version before 4.8.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants