Skip to content

podman_compose: fix in-pod argparse type #712

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

Closed
wants to merge 1 commit into from

Conversation

StaticRocket
Copy link
Contributor

If "bool" is provided as an argparse type it will only evaluate to false if an empty string is provided. This lambda attempts to resolve this by filtering for "1" or "true".

I used a lambda here for backwards compatibility as argparse didn't add the BooleanOptionalAction action until 3.9 and you still advertise 3.7 compatibility in the README and setup.

I was looking at a previous attempt to resolve this ( #546 ) and noticed it was NAK'd for not allowing auto selection but considering the systemd template that's currently present, auto selection is not possible and we seem to be making the assumption that the default value is true.

Maybe the arg should be dropped entirely? The stable release included that template with in-pod defaulting to False leading to fun behavior described in #695 . This is uncorrectable from the user side as the script calls itself with minimal args to create the container before registering it.

If "bool" is provided as an argparse type it will only evaluate to false
if an empty string is provided. This lambda attempts to resolve this by
filtering for "1" or "true".

Signed-off-by: Randolph Sapp <[email protected]>
@p12tic
Copy link
Collaborator

p12tic commented Apr 28, 2024

Thanks for the PR. I rewrote this idea to be more complete and actually check that the passed value can be converted to bool (empty, 1, true, 0, false). Otherwise nonsense values would still be accepted.

The improved PR is this one #918. Thanks a lot for the suggested fix.

@p12tic p12tic closed this Apr 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants