Commit Graph

13 Commits

Author SHA1 Message Date
Oleksandr Redko 2a2d0b0e18 chore: delete obsolete // +build lines
Signed-off-by: Oleksandr Redko <Oleksandr_Redko@epam.com>
2024-01-04 11:53:38 +02:00
Paul Holzinger 1d16309908
pkg/systemd/generate: add !remote tag
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2023-10-24 12:19:30 +02:00
Valentin Rothberg 2d517b687b generate systemd: support entrypoint JSON strings
Make sure to preserve the quoting of entrypoint JSON strings.

Fixes: #12477
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-12-08 15:51:23 +01:00
Valentin Rothberg d1573b95e3 generate systemd: handle --restart
Handle custom restart policies of containers when generating the unit
files; those should be set on the unit level and removed from ExecStart
flags.

Fixes: #11438
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-09-07 13:58:11 +02:00
Valentin Rothberg 274d6fa19c generate systemd: use --cidfile again
Commit 9ac5267 changed the type of the generated systemd units from
`forking` to `notify`.  It further stopped using `--cidfile` and instead
intended systemd to take care of stopping the container, which turned
out to be a bad idea.

Systemd will send the stop/kill signals to conmon which in turn may exit
non-zero, depending on the signal, and ultimately breaking container
cleanup.

Hence, we need to use --cidfile again and let podman stop and remove the
container to make sure that everything's in order.

Fixes: #11304
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-08-24 15:46:00 +02:00
Valentin Rothberg 9ac5267598 systemd/generate: change type to notify
Change the type of units generated with --new from "forking" to
"notify".  This brings Podman closer to systemd and opens up
Podman to a number of use cases (see #5572).

Units generated without --new remain with `type=forking`.  I
experimented a bit with adding a `--sdnotify` flag to `podman start` but
it doesn't really work well since we're competing with the default
sdnotify mode set during container creation.

Fixes: #5572
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-06-04 10:17:25 +02:00
Daniel J Walsh 9c8277247d
Fixes from make codespell
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-04-21 13:16:33 -04:00
Paul Holzinger aabafc5b1b podman generate systemd --new do not duplicate params
podman generate systemd --new inserts extra idfile arguments. The
generated unit can break when the user did provide their own idfile
arguments as they overwrite the arguments added by generate systemd.
This also happens when a user tries to generate the systemd unit on
a container already create with a --new unit. This should now
create a identical unit. The solution is to remove all user provided
idfile arguments.

This commit also ensures that we do not remove arguments that are part
off the containers entrypoint.

Fixes #9776

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2021-03-28 20:01:17 +02:00
Paul Holzinger 78c8a87362 Enable whitespace linter
Use the whitespace linter and fix the reported problems.

[NO TESTS NEEDED]

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2021-02-11 23:01:56 +01:00
Paul Holzinger 5352df226b Fix podman generate systemd --new special char handling
In a systemd unit dollar and percent signs are used for variables. A backslash
is used for escape sequences. If any of these characters are used in the create
command we have to properly escape them so systemd does not try to interpret them.

Fixes #9176

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2021-02-01 14:40:12 +01:00
Valentin Rothberg b1ffa2324e generate systemd: quote arguments with whitespace
Make sure that arguments with whitespace are properly quoted so they are
interpreted as one (and not multiple ones) by systemd.

Now `-e tz="america/new york"` will be generated as `-e "tz=america/new york"`.
The quotes are moving but the argument is still correct.

Fixes: #7285
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-08-19 08:32:51 +02:00
Valentin Rothberg 2fed50f431 generate systemd: improve pod-flags filter
When generating systemd unit for pods, we need to remove certain
pod-related flags from the containers' create commands.  Make sure
to account for all the syntax including a single argument with key and
value being split by `=`.

Fixes: #6766
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-06-25 10:13:58 +02:00
Valentin Rothberg 8d8746adee generate systemd: create pod template
Create a new template for generating a pod unit file. Eventually, this
allows for treating and extending pod and container generation
seprately.

The `--new` flag now also works on pods.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-06-11 11:01:13 +02:00