Skip to content
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

Quadlet Label Value Truncation Due to Missing Quotes #807

Open
tjmullicani opened this issue Jul 18, 2024 · 1 comment
Open

Quadlet Label Value Truncation Due to Missing Quotes #807

tjmullicani opened this issue Jul 18, 2024 · 1 comment
Labels
wontfix This will not be worked on

Comments

@tjmullicani
Copy link

tjmullicani commented Jul 18, 2024

Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)

/kind bug

Description
When a Quadlet file is written, the "Label=" line values are not quoted. This causes issues if there are special or escape characters in the value.

For example, the following quadlet file is currently generated.

[Container]
ContainerName=testapp
...
Label=traefik.enable=True
Label=traefik.http.routers.testapp.rule=( Host(`test.com`) && PathPrefix(`/path`) )

When it should be (notice the extra quotes around Label=.

[Container]
ContainerName=testapp
...
Label=traefik.enable="True"
Label=traefik.http.routers.testapp.rule="( Host(`test.com`) && PathPrefix(`/path`) )"

Steps to reproduce the issue:

- containers.podman.podman_container:
     name: testapp
     state: quadlet
     quadlet_filename: container-testapp
     quadlet_options:
       - "AutoUpdate=registry"
       - "Pull=always"
       - |
         [Install]
         WantedBy=default.target
    network:
      - podman
    image: docker.io/containous/whoami
    labels:
      traefik.enable: true
      traefik.http.routers.testapp.rule: "( Host(`test.com`) && PathPrefix(`/path`) )"

Describe the results you received:

$ podman inspect testapp
...
      "Labels": {
        "traefik.http.routers.testapp.rule": "(",
      }

Describe the results you expected:

$ podman inspect testapp
...
      "Labels": {
        "traefik.http.routers.testapp.rule": "( Host(`test.com`) && PathPrefix(`/path`) )",
      }

Double quoting the label within containers.podman.podmain_container is a workaround.

...
- containers.podman.podman_container:
    ...
    labels:
      traefik.http.routers.testapp.rule: "\"( Host(`test.com`) && PathPrefix(`/path`)\""
...

Version of the containers.podman collection:
Either git commit if installed from git: git show --summary
Or version from ansible-galaxy if installed from galaxy: ansible-galaxy collection list | grep containers.podman

1.15.4

Output of ansible --version:

ansible [core 2.15.10]

Output of podman version:

$ podman --version
podman version 4.9.4-rhel

Package info (e.g. output of rpm -q podman or apt list podman):

$ rpm -q podman
podman-4.9.4-4.module+el8.10.0+21995+81e8507c.x86_64
@sshnaidm
Copy link
Member

I think this workaround might be actually a legit way to do quotes inside, anyway we'll need to escape quotes in the label value if they exist.

@sshnaidm sshnaidm added the wontfix This will not be worked on label Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants