-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Make podman generate systemd --new flag parsing more robust #8851
Make podman generate systemd --new flag parsing more robust #8851
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Luap99 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 |
Is there a corner case where a user could specify something like podman run -d --detach=false alpine sleep 100 And we end up with using the first -d? |
|
33c3029
to
feb8f37
Compare
It is valid but not what the user requested. podman run -d --detach=false alpine sleep 100 With your change it will be treated as BTW I have no problem if we just make running multiple --detach commands fail. |
The whole point of the --new flag is that we must add detach regardless of what the user requested. If there is no detach systemctl start will fail on that unit. |
Should it fail then if the user requested it not to detach? |
Sorry for butting in but I don't think systemd will fail with no detach. Here is my example that runs well. [Unit] [Service] [Install] |
Yes it works when the unit type is simple but we set the type to forking. |
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.
Thanks for tackling it, really nice work!
Please make sure to split future commits into separate pieces. This commit applies too many changes at once which makes it hard to review and may hinder backporting. But we're close to a new release, so we're good.
First, use the pflag library to parse the flags. With this we can handle all corner cases such as -td or --detach=false. Second, preserve the root args with --new. They are used for all podman commands in the unit file. (e.g. podman --root /tmp run alpine) Signed-off-by: Paul Holzinger <[email protected]>
feb8f37
to
ef82be4
Compare
LGTM |
/lgtm |
PR containers#8851 broke CI: it included "/var/run" strings that, per containers#8771, should have been just "/run". Signed-off-by: Ed Santiago <[email protected]>
PR containers#8851 broke CI: it included "/var/run" strings that, per containers#8771, should have been just "/run". Signed-off-by: Ed Santiago <[email protected]>
First, use the pflag library to parse the flags. With this we can
handle all corner cases such as -td or --detach=false.
Second, preserve the root args with --new. They are used for all podman
commands in the unit file. (e.g. podman --root /tmp run alpine)
Fixes #8847