summaryrefslogtreecommitdiff
path: root/pkg/systemd/generate/pods.go
diff options
context:
space:
mode:
authorPaul Holzinger <paul.holzinger@web.de>2021-02-01 14:40:12 +0100
committerPaul Holzinger <paul.holzinger@web.de>2021-02-01 14:40:12 +0100
commit5352df226bc3f345836e78b73063de91d34b4e85 (patch)
tree4532290710da4bb2d9eb32f7ffe3673d0f5288ac /pkg/systemd/generate/pods.go
parentb045c173756dddcedf6a99a70f520bf423072826 (diff)
downloadpodman-5352df226bc3f345836e78b73063de91d34b4e85.tar.gz
podman-5352df226bc3f345836e78b73063de91d34b4e85.tar.bz2
podman-5352df226bc3f345836e78b73063de91d34b4e85.zip
Fix podman generate systemd --new special char handling
In a systemd unit dollar and percent signs are used for variables. A backslash is used for escape sequences. If any of these characters are used in the create command we have to properly escape them so systemd does not try to interpret them. Fixes #9176 Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
Diffstat (limited to 'pkg/systemd/generate/pods.go')
-rw-r--r--pkg/systemd/generate/pods.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/pkg/systemd/generate/pods.go b/pkg/systemd/generate/pods.go
index c7e3aa955..d6ede19af 100644
--- a/pkg/systemd/generate/pods.go
+++ b/pkg/systemd/generate/pods.go
@@ -269,7 +269,7 @@ func executePodTemplate(info *podInfo, options entities.GenerateSystemdOptions)
return "", errors.Errorf("pod does not appear to be created via `podman pod create`: %v", info.CreateCommand)
}
podRootArgs = info.CreateCommand[1 : podCreateIndex-1]
- info.RootFlags = strings.Join(quoteArguments(podRootArgs), " ")
+ info.RootFlags = strings.Join(escapeSystemdArguments(podRootArgs), " ")
podCreateArgs = filterPodFlags(info.CreateCommand[podCreateIndex+1:])
}
// We're hard-coding the first five arguments and append the
@@ -306,7 +306,7 @@ func executePodTemplate(info *podInfo, options entities.GenerateSystemdOptions)
}
startCommand = append(startCommand, podCreateArgs...)
- startCommand = quoteArguments(startCommand)
+ startCommand = escapeSystemdArguments(startCommand)
info.ExecStartPre1 = "/bin/rm -f {{{{.PIDFile}}}} {{{{.PodIDFile}}}}"
info.ExecStartPre2 = strings.Join(startCommand, " ")