mirror of https://github.com/containers/podman.git
Merge pull request #17487 from vrothberg/quadlet-stop
quadlet: add ExecStop
This commit is contained in:
commit
4debbd108b
|
@ -287,13 +287,15 @@ func ConvertContainer(container *parser.UnitFile, isUser bool) (*parser.UnitFile
|
|||
// Need the containers filesystem mounted to start podman
|
||||
service.Add(UnitGroup, "RequiresMountsFor", "%t/containers")
|
||||
|
||||
// If the conman exited uncleanly it may not have removed the container, so force it,
|
||||
// -i makes it ignore non-existing files.
|
||||
// If conmon exited uncleanly it may not have removed the container, so
|
||||
// force it, -i makes it ignore non-existing files.
|
||||
service.Add(ServiceGroup, "ExecStop", podmanBinary()+" rm -f -i --cidfile=%t/%N.cid")
|
||||
// The ExecStopPost is needed when the main PID (i.e., conmon) gets killed.
|
||||
// In that case, ExecStop is not executed but *Post only. If both are
|
||||
// fired in sequence, *Post will exit when detecting that the --cidfile
|
||||
// has already been removed by the previous `rm`..
|
||||
service.Add(ServiceGroup, "ExecStopPost", "-"+podmanBinary()+" rm -f -i --cidfile=%t/%N.cid")
|
||||
|
||||
// Remove the cid file, to avoid confusion as the container is no longer running.
|
||||
service.Add(ServiceGroup, "ExecStopPost", "-rm -f %t/%N.cid")
|
||||
|
||||
podman := NewPodmanCmdline("run")
|
||||
|
||||
podman.addf("--name=%s", containerName)
|
||||
|
|
|
@ -14,7 +14,8 @@
|
|||
## assert-key-is "Service" "Type" "notify"
|
||||
## assert-key-is "Service" "NotifyAccess" "all"
|
||||
## assert-key-is "Service" "SyslogIdentifier" "%N"
|
||||
## assert-key-is-regex "Service" "ExecStopPost" "-.*/podman rm -f -i --cidfile=%t/%N.cid" "-rm -f %t/%N.cid"
|
||||
## assert-key-is-regex "Service" "ExecStopPost" "-.*/podman rm -f -i --cidfile=%t/%N.cid"
|
||||
## assert-key-is-regex "Service" "ExecStop" ".*/podman rm -f -i --cidfile=%t/%N.cid"
|
||||
## assert-key-is "Service" "Environment" "PODMAN_SYSTEMD_UNIT=%n"
|
||||
|
||||
[Container]
|
||||
|
|
Loading…
Reference in New Issue