-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
podman generate systemd doesn't work as expected while using --new flag and container with log-opt tag set #9034
Comments
Thanks for reaching out, @sixeIa! The tricky part is the I will play with it a bit and check what we can do. |
The easiest thing might be changing the delimiter for the internal template https://golang.org/pkg/text/template/#Template.Delims |
EDIT: the problem is that we're also using Go templating to generate the container, so What you can do as a workaround_ is to remove |
And it could not exist something to escape the {{ .Name }} ? Yes that's what we're doing now. |
@Luap99 got time to tackle it? |
@vrothberg Yes. I will tackle it. |
Thanks, @Luap99 ! |
PR #9035 to fix |
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 containers#9034 Signed-off-by: Paul Holzinger <[email protected]>
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 containers#9034 Signed-off-by: Paul Holzinger <[email protected]>
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 containers#9034 Signed-off-by: Paul Holzinger <[email protected]>
Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)
/kind bug
Description
While creating a container with
--log-driver=journald
and --log-opt=tag={{.Name}} specified, we're unable to generate a systemd file while forcing --new.Facing an error: "Error: template: container_template:15:162: executing "container_template" at <.Name>: can't evaluate field Name in type *generate.containerInfo"
Steps to reproduce the issue:
Create a random container (in this example, nginx):
sudo podman run -d --log-driver=journald --log-opt=tag={{.Name}} --name=nginx nginx
Try to generate systemd file
sudo podman generate systemd --name nginx --new
Describe the results you received:
Error: template: container_template:15:162: executing "container_template" at <.Name>: can't evaluate field Name in type *generate.containerInfo
Describe the results you expected:
Systemd file generated with log-opt option set correctly.
Output of
podman version
:Output of
podman info --debug
:Package info (e.g. output of
rpm -q podman
orapt list podman
):Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide?
Yes
Additional environment details (AWS, VirtualBox, physical, etc.):
Tried on a Fedora 33 virtual machine
The text was updated successfully, but these errors were encountered: