generate systemd: remove leading slashes

Remove leading slashes from the run-dir paths. It was meant to make it
explicit that we're dealing with an absolute path but user feedback has
shown that most are aware.  It also cleans up the path in the systemctl
status output.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
This commit is contained in:
Valentin Rothberg
2020-03-05 14:05:48 +01:00
parent 9ffc525da7
commit a5c04c793e
3 changed files with 12 additions and 12 deletions

View File

@ -96,11 +96,11 @@ Before={{- range $index, $value := .RequiredServices -}}{{if $index}} {{end}}{{
[Service] [Service]
Restart={{.RestartPolicy}} Restart={{.RestartPolicy}}
{{- if .New}} {{- if .New}}
ExecStartPre=/usr/bin/rm -f /%t/%n-pid /%t/%n-cid ExecStartPre=/usr/bin/rm -f %t/%n-pid %t/%n-cid
ExecStart={{.RunCommand}} ExecStart={{.RunCommand}}
ExecStop={{.Executable}} stop --ignore --cidfile /%t/%n-cid {{if (ge .StopTimeout 0)}}-t {{.StopTimeout}}{{end}} ExecStop={{.Executable}} stop --ignore --cidfile %t/%n-cid {{if (ge .StopTimeout 0)}}-t {{.StopTimeout}}{{end}}
ExecStopPost={{.Executable}} rm --ignore -f --cidfile /%t/%n-cid ExecStopPost={{.Executable}} rm --ignore -f --cidfile %t/%n-cid
PIDFile=/%t/%n-pid PIDFile=%t/%n-pid
{{- else}} {{- else}}
ExecStart={{.Executable}} start {{.ContainerName}} ExecStart={{.Executable}} start {{.ContainerName}}
ExecStop={{.Executable}} stop {{if (ge .StopTimeout 0)}}-t {{.StopTimeout}}{{end}} {{.ContainerName}} ExecStop={{.Executable}} stop {{if (ge .StopTimeout 0)}}-t {{.StopTimeout}}{{end}} {{.ContainerName}}
@ -160,8 +160,8 @@ func CreateContainerSystemdUnit(info *ContainerInfo, opts Options) (string, erro
command := []string{ command := []string{
info.Executable, info.Executable,
"run", "run",
"--conmon-pidfile", "/%t/%n-pid", "--conmon-pidfile", "%t/%n-pid",
"--cidfile", "/%t/%n-cid", "--cidfile", "%t/%n-cid",
"--cgroups=no-conmon", "--cgroups=no-conmon",
} }
command = append(command, info.CreateCommand[index:]...) command = append(command, info.CreateCommand[index:]...)

View File

@ -131,11 +131,11 @@ After=network-online.target
[Service] [Service]
Restart=always Restart=always
ExecStartPre=/usr/bin/rm -f /%t/%n-pid /%t/%n-cid ExecStartPre=/usr/bin/rm -f %t/%n-pid %t/%n-cid
ExecStart=/usr/bin/podman run --conmon-pidfile /%t/%n-pid --cidfile /%t/%n-cid --cgroups=no-conmon --name jadda-jadda --hostname hello-world awesome-image:latest command arg1 ... argN ExecStart=/usr/bin/podman run --conmon-pidfile %t/%n-pid --cidfile %t/%n-cid --cgroups=no-conmon --name jadda-jadda --hostname hello-world awesome-image:latest command arg1 ... argN
ExecStop=/usr/bin/podman stop --ignore --cidfile /%t/%n-cid -t 42 ExecStop=/usr/bin/podman stop --ignore --cidfile %t/%n-cid -t 42
ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile /%t/%n-cid ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile %t/%n-cid
PIDFile=/%t/%n-pid PIDFile=%t/%n-pid
KillMode=none KillMode=none
Type=forking Type=forking

View File

@ -191,7 +191,7 @@ var _ = Describe("Podman generate systemd", func() {
found, _ := session.GrepString("# container-foo.service") found, _ := session.GrepString("# container-foo.service")
Expect(found).To(BeTrue()) Expect(found).To(BeTrue())
found, _ = session.GrepString("stop --ignore --cidfile /%t/%n-cid -t 42") found, _ = session.GrepString("stop --ignore --cidfile %t/%n-cid -t 42")
Expect(found).To(BeTrue()) Expect(found).To(BeTrue())
}) })