summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-03-05 09:28:41 -0500
committerGitHub <noreply@github.com>2020-03-05 09:28:41 -0500
commit36260286402a514417b642abd8f45a800f0dc9da (patch)
tree6c2601a0902358e9c9585bae68de1b1a1b3054b7
parent9ffc525da70ba497f38df04dd6d3670170200071 (diff)
parenta5c04c793e5e3d4d7c52a2281205fcace4f2534a (diff)
downloadpodman-36260286402a514417b642abd8f45a800f0dc9da.tar.gz
podman-36260286402a514417b642abd8f45a800f0dc9da.tar.bz2
podman-36260286402a514417b642abd8f45a800f0dc9da.zip
Merge pull request #5400 from vrothberg/systemd-gen-cleanup
generate systemd: remove leading slashes
-rw-r--r--pkg/systemd/generate/systemdgen.go12
-rw-r--r--pkg/systemd/generate/systemdgen_test.go10
-rw-r--r--test/e2e/generate_systemd_test.go2
3 files changed, 12 insertions, 12 deletions
diff --git a/pkg/systemd/generate/systemdgen.go b/pkg/systemd/generate/systemdgen.go
index 999a65126..00ddc63f3 100644
--- a/pkg/systemd/generate/systemdgen.go
+++ b/pkg/systemd/generate/systemdgen.go
@@ -96,11 +96,11 @@ Before={{- range $index, $value := .RequiredServices -}}{{if $index}} {{end}}{{
[Service]
Restart={{.RestartPolicy}}
{{- 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}}
-ExecStop={{.Executable}} stop --ignore --cidfile /%t/%n-cid {{if (ge .StopTimeout 0)}}-t {{.StopTimeout}}{{end}}
-ExecStopPost={{.Executable}} rm --ignore -f --cidfile /%t/%n-cid
-PIDFile=/%t/%n-pid
+ExecStop={{.Executable}} stop --ignore --cidfile %t/%n-cid {{if (ge .StopTimeout 0)}}-t {{.StopTimeout}}{{end}}
+ExecStopPost={{.Executable}} rm --ignore -f --cidfile %t/%n-cid
+PIDFile=%t/%n-pid
{{- else}}
ExecStart={{.Executable}} start {{.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{
info.Executable,
"run",
- "--conmon-pidfile", "/%t/%n-pid",
- "--cidfile", "/%t/%n-cid",
+ "--conmon-pidfile", "%t/%n-pid",
+ "--cidfile", "%t/%n-cid",
"--cgroups=no-conmon",
}
command = append(command, info.CreateCommand[index:]...)
diff --git a/pkg/systemd/generate/systemdgen_test.go b/pkg/systemd/generate/systemdgen_test.go
index a68a02d33..145296ea9 100644
--- a/pkg/systemd/generate/systemdgen_test.go
+++ b/pkg/systemd/generate/systemdgen_test.go
@@ -131,11 +131,11 @@ After=network-online.target
[Service]
Restart=always
-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
-ExecStop=/usr/bin/podman stop --ignore --cidfile /%t/%n-cid -t 42
-ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile /%t/%n-cid
-PIDFile=/%t/%n-pid
+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
+ExecStop=/usr/bin/podman stop --ignore --cidfile %t/%n-cid -t 42
+ExecStopPost=/usr/bin/podman rm --ignore -f --cidfile %t/%n-cid
+PIDFile=%t/%n-pid
KillMode=none
Type=forking
diff --git a/test/e2e/generate_systemd_test.go b/test/e2e/generate_systemd_test.go
index d0dadd09d..31131a68b 100644
--- a/test/e2e/generate_systemd_test.go
+++ b/test/e2e/generate_systemd_test.go
@@ -191,7 +191,7 @@ var _ = Describe("Podman generate systemd", func() {
found, _ := session.GrepString("# container-foo.service")
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())
})