quadlet: Use the new podman create volume --ignore

This way we don't have to use the `ExecCondition=podman volume exist`,
which saves one process start.

Signed-off-by: Alexander Larsson <alexl@redhat.com>
This commit is contained in:
Alexander Larsson 2022-10-21 09:17:28 +02:00
parent 734c435e01
commit b7f05cef0b
2 changed files with 2 additions and 6 deletions

View File

@ -659,11 +659,9 @@ func ConvertVolume(volume *parser.UnitFile, name string) (*parser.UnitFile, erro
// Need the containers filesystem mounted to start podman
service.Add(UnitGroup, "RequiresMountsFor", "%t/containers")
execCond := fmt.Sprintf("/usr/bin/bash -c \"! /usr/bin/podman volume exists %s\"", volumeName)
labels := volume.LookupAllKeyVal(VolumeGroup, "Label")
podman := NewPodmanCmdline("volume", "create")
podman := NewPodmanCmdline("volume", "create", "--ignore")
var opts strings.Builder
opts.WriteString("o=")
@ -696,7 +694,6 @@ func ConvertVolume(volume *parser.UnitFile, name string) (*parser.UnitFile, erro
service.Setv(ServiceGroup,
"Type", "oneshot",
"RemainAfterExit", "yes",
"ExecCondition", execCond,
// The default syslog identifier is the exec basename (podman) which isn't very useful here
"SyslogIdentifier", "%N")

View File

@ -1,8 +1,7 @@
## assert-key-is Unit RequiresMountsFor "%t/containers"
## assert-key-is Service Type oneshot
## assert-key-is Service RemainAfterExit yes
## assert-key-is Service ExecCondition '/usr/bin/bash -c "! /usr/bin/podman volume exists systemd-basic"'
## assert-key-is Service ExecStart "/usr/bin/podman volume create systemd-basic"
## assert-key-is Service ExecStart "/usr/bin/podman volume create --ignore systemd-basic"
## assert-key-is Service SyslogIdentifier "%N"
[Volume]