aboutsummaryrefslogtreecommitdiff
path: root/pkg/systemd/generate/containers.go
diff options
context:
space:
mode:
authorValentin Rothberg <vrothberg@redhat.com>2022-09-14 14:10:19 +0200
committerValentin Rothberg <vrothberg@redhat.com>2022-09-15 13:15:35 +0200
commitc20abf12c714f359c7bbb291c444530f70cb1185 (patch)
treef92a0a6f43af9360a415e04957870148b4b628e2 /pkg/systemd/generate/containers.go
parent2a8df49c2a65831fa2c253afa1ad2b5e1d618b09 (diff)
downloadpodman-c20abf12c714f359c7bbb291c444530f70cb1185.tar.gz
podman-c20abf12c714f359c7bbb291c444530f70cb1185.tar.bz2
podman-c20abf12c714f359c7bbb291c444530f70cb1185.zip
generate systemd: drop ExecStop
Drop the ExecStop step to simplify the generated units a bit. The extra ExecStopPost step was added by commit e5c343294424. If the main PID (i.e., conmon) is killed, systemd will not execute ExecStop (since the main PID is already down) but only execute the *Post steps. Credits to the late Ulrich Obergfell for tracking this issue down; he is missed. The ExecStop step can safely be dropped since the Post step will take of stopping (and removing) in any case. Context: #15686 Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
Diffstat (limited to 'pkg/systemd/generate/containers.go')
-rw-r--r--pkg/systemd/generate/containers.go6
1 files changed, 0 insertions, 6 deletions
diff --git a/pkg/systemd/generate/containers.go b/pkg/systemd/generate/containers.go
index 8510cfd42..fe7c9a333 100644
--- a/pkg/systemd/generate/containers.go
+++ b/pkg/systemd/generate/containers.go
@@ -46,7 +46,6 @@ type containerInfo struct {
ExecStart string
TimeoutStartSec uint
TimeoutStopSec uint
- ExecStop string
ExecStopPost string
GenerateNoHeader bool
Pod *podInfo
@@ -98,9 +97,6 @@ TimeoutStopSec={{{{.TimeoutStopSec}}}}
ExecStartPre={{{{.ExecStartPre}}}}
{{{{- end}}}}
ExecStart={{{{.ExecStart}}}}
-{{{{- if .ExecStop}}}}
-ExecStop={{{{.ExecStop}}}}
-{{{{- end}}}}
{{{{- if .ExecStopPost}}}}
ExecStopPost={{{{.ExecStopPost}}}}
{{{{- end}}}}
@@ -294,7 +290,6 @@ func executeContainerTemplate(info *containerInfo, options entities.GenerateSyst
info.Type = "forking"
info.EnvVariable = define.EnvVariable
info.ExecStart = "{{{{.Executable}}}} start {{{{.ContainerNameOrID}}}}"
- info.ExecStop = "{{{{.Executable}}}} stop {{{{if (ge .StopTimeout 0)}}}}-t {{{{.StopTimeout}}}}{{{{end}}}} {{{{.ContainerNameOrID}}}}"
info.ExecStopPost = "{{{{.Executable}}}} stop {{{{if (ge .StopTimeout 0)}}}}-t {{{{.StopTimeout}}}}{{{{end}}}} {{{{.ContainerNameOrID}}}}"
for i, env := range info.AdditionalEnvVariables {
info.AdditionalEnvVariables[i] = escapeSystemdArg(env)
@@ -313,7 +308,6 @@ func executeContainerTemplate(info *containerInfo, options entities.GenerateSyst
info.PIDFile = ""
info.ContainerIDFile = "%t/%n.ctr-id"
info.ExecStartPre = "/bin/rm -f {{{{.ContainerIDFile}}}}"
- info.ExecStop = "{{{{.Executable}}}} stop --ignore --cidfile={{{{.ContainerIDFile}}}}"
info.ExecStopPost = "{{{{.Executable}}}} rm -f --ignore --cidfile={{{{.ContainerIDFile}}}}"
// The create command must at least have three arguments:
// /usr/bin/podman run $IMAGE