diff options
author | Paul Holzinger <paul.holzinger@web.de> | 2021-01-20 14:30:42 +0100 |
---|---|---|
committer | Paul Holzinger <paul.holzinger@web.de> | 2021-01-20 15:07:37 +0100 |
commit | c3cbaa355cde1eb07466f553d01765589fb6aeef (patch) | |
tree | 54fd4adf0b84ac99dc2a3f2ac1eaba9581970475 /pkg/systemd/generate/common.go | |
parent | 7d024a2fc8c675e4d34e3b34b56b6217a48ef9ce (diff) | |
download | podman-c3cbaa355cde1eb07466f553d01765589fb6aeef.tar.gz podman-c3cbaa355cde1eb07466f553d01765589fb6aeef.tar.bz2 podman-c3cbaa355cde1eb07466f553d01765589fb6aeef.zip |
Make generate systemd --new robust against double curly braces
If the container create command contains an argument with double
curly braces the golang template parsing can fail since it tries
to interpret the value as variable. To fix this change the default
delimiter for the internal template to `{{{{`.
Fixes #9034
Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
Diffstat (limited to 'pkg/systemd/generate/common.go')
-rw-r--r-- | pkg/systemd/generate/common.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/pkg/systemd/generate/common.go b/pkg/systemd/generate/common.go index 8901298db..de6751a17 100644 --- a/pkg/systemd/generate/common.go +++ b/pkg/systemd/generate/common.go @@ -30,14 +30,14 @@ func validateRestartPolicy(restart string) error { return errors.Errorf("%s is not a valid restart policy", restart) } -const headerTemplate = `# {{.ServiceName}}.service -# autogenerated by Podman {{.PodmanVersion}} -{{- if .TimeStamp}} -# {{.TimeStamp}} -{{- end}} +const headerTemplate = `# {{{{.ServiceName}}}}.service +# autogenerated by Podman {{{{.PodmanVersion}}}} +{{{{- if .TimeStamp}}}} +# {{{{.TimeStamp}}}} +{{{{- end}}}} [Unit] -Description=Podman {{.ServiceName}}.service +Description=Podman {{{{.ServiceName}}}}.service Documentation=man:podman-generate-systemd(1) Wants=network.target After=network-online.target |