summaryrefslogtreecommitdiff
path: root/pkg/systemd/generate/common.go
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2021-06-03 15:56:18 +0200
committerValentin Rothberg <rothberg@redhat.com>2021-06-04 10:17:25 +0200
commit9ac5267598c3665eb152bf73afba14495b9674f4 (patch)
tree8e5b451308a09324f556b5ca3f54080e2176cab8 /pkg/systemd/generate/common.go
parentb64e20a53d3f5de262f2c475be490b35977d5f32 (diff)
downloadpodman-9ac5267598c3665eb152bf73afba14495b9674f4.tar.gz
podman-9ac5267598c3665eb152bf73afba14495b9674f4.tar.bz2
podman-9ac5267598c3665eb152bf73afba14495b9674f4.zip
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>
Diffstat (limited to 'pkg/systemd/generate/common.go')
-rw-r--r--pkg/systemd/generate/common.go11
1 files changed, 7 insertions, 4 deletions
diff --git a/pkg/systemd/generate/common.go b/pkg/systemd/generate/common.go
index 1ee070888..e183125a7 100644
--- a/pkg/systemd/generate/common.go
+++ b/pkg/systemd/generate/common.go
@@ -60,7 +60,7 @@ func filterPodFlags(command []string, argCount int) []string {
return processed
}
-// filterCommonContainerFlags removes --conmon-pidfile, --cidfile and --cgroups from the specified command.
+// filterCommonContainerFlags removes --sdnotify, --rm and --cgroups from the specified command.
// argCount is the number of last arguments which should not be filtered, e.g. the container entrypoint.
func filterCommonContainerFlags(command []string, argCount int) []string {
processed := []string{}
@@ -68,11 +68,14 @@ func filterCommonContainerFlags(command []string, argCount int) []string {
s := command[i]
switch {
- case s == "--conmon-pidfile", s == "--cidfile", s == "--cgroups":
+ case s == "--rm":
+ // Boolean flags support --flag and --flag={true,false}.
+ continue
+ case s == "--sdnotify", s == "--cgroups":
i++
continue
- case strings.HasPrefix(s, "--conmon-pidfile="),
- strings.HasPrefix(s, "--cidfile="),
+ case strings.HasPrefix(s, "--sdnotify="),
+ strings.HasPrefix(s, "--rm="),
strings.HasPrefix(s, "--cgroups="):
continue
}