diff options
author | Valentin Rothberg <vrothberg@redhat.com> | 2022-09-15 17:56:39 +0200 |
---|---|---|
committer | Valentin Rothberg <vrothberg@redhat.com> | 2022-09-15 17:56:45 +0200 |
commit | 884fd4575c12a4cc32af06f5a239cb47609a15df (patch) | |
tree | 7f73d03bf3c3a7fe41784f8e9c0a3de3b91933d0 /pkg/systemd/generate/containers.go | |
parent | 50c538b3cc7a218fe009180bbe20b0c464add6f7 (diff) | |
download | podman-884fd4575c12a4cc32af06f5a239cb47609a15df.tar.gz podman-884fd4575c12a4cc32af06f5a239cb47609a15df.tar.bz2 podman-884fd4575c12a4cc32af06f5a239cb47609a15df.zip |
Revert "generate systemd: drop ExecStop"
This reverts commit c20abf12c714f359c7bbb291c444530f70cb1185. In the
absence of `ExecStop` step, systemd will send the stop/kill signals to
the main PID while I asummed that systemd would jump directly to an
ExecStopPost step instead.
Hence revert the commit to let Podman take care of stopping rather than
systemd.
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
Diffstat (limited to 'pkg/systemd/generate/containers.go')
-rw-r--r-- | pkg/systemd/generate/containers.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/pkg/systemd/generate/containers.go b/pkg/systemd/generate/containers.go index fe7c9a333..8510cfd42 100644 --- a/pkg/systemd/generate/containers.go +++ b/pkg/systemd/generate/containers.go @@ -46,6 +46,7 @@ type containerInfo struct { ExecStart string TimeoutStartSec uint TimeoutStopSec uint + ExecStop string ExecStopPost string GenerateNoHeader bool Pod *podInfo @@ -97,6 +98,9 @@ TimeoutStopSec={{{{.TimeoutStopSec}}}} ExecStartPre={{{{.ExecStartPre}}}} {{{{- end}}}} ExecStart={{{{.ExecStart}}}} +{{{{- if .ExecStop}}}} +ExecStop={{{{.ExecStop}}}} +{{{{- end}}}} {{{{- if .ExecStopPost}}}} ExecStopPost={{{{.ExecStopPost}}}} {{{{- end}}}} @@ -290,6 +294,7 @@ 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) @@ -308,6 +313,7 @@ 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 |