-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
quadlet: Handle booleans that have defaults better #16893
quadlet: Handle booleans that have defaults better #16893
Conversation
We add a regular LookupBoolean that can fail lookups, which is used by the WithDefault version. We want to use this directly later in some places. It is fina to change API here because this has not been in a release yet. Signed-off-by: Alexander Larsson <[email protected]>
The ReadOnly and the RunInit keys affect options that have a variable default (configurable in containers.conf). This means we need to handle them a bit differently in quadlet to allow overriding the default. For example, we can't assume ReadOnly=false doesn't need to add any argument because no argument may mean readonly=true if the default is changed. We now don't add any argument (leaving the default) if the key is not specified, or we always add an argument (--foo or --foo=false) if the key is specified (overriding whatever the default is). Signed-off-by: Alexander Larsson <[email protected]>
Weird CI error:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Re: API. It's an internal API of Podman, so we are free to break :)
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alexlarsson, vrothberg The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
} | ||
|
||
// By default we handle startup notification with conmon, but allow passing it to the container with Notify=yes | ||
notify := container.LookupBoolean(ContainerGroup, KeyNotify, false) | ||
notify := container.LookupBooleanWithDefault(ContainerGroup, KeyNotify, false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since 'LookupBooleanreturn
falsewhen the key is not found. Is there any advantage of using
LookupBooleanWithDefaultwith
false` as default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not technically, but it imho makes the code intention clearer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
Some CI network hickup it seems. |
LGTM |
/lgtm |
/hold cancel |
The ReadOnly and the RunInit keys affect options that have a variable default (configurable in containers.conf). This means we need to handle them a bit differently in quadlet to allow overriding the default. For example, we can't assume
ReadOnly=false
doesn't need to add any argument because no argument may mean read-only is enabled if the default is changed.We now don't add any argument (leaving the default) if the key is not specified, or we always add an argument (
--foo
or--foo=false
) if the key is specified (overriding whatever the default is).