mirror of
https://github.com/containers/ansible-podman-collections.git
synced 2026-02-04 07:11:49 +00:00
correctly quote labels and environment variables for quadlets (#920)
Fixes: #807 Signed-off-by: Evgeni Golov <evgeni@golov.de> Signed-off-by: johnsonlien <johnsonlien95@gmail.com>
This commit is contained in:
parent
7e21a7eee6
commit
d4aa649809
2 changed files with 9 additions and 2 deletions
|
|
@ -5,6 +5,7 @@ from __future__ import absolute_import, division, print_function
|
|||
__metaclass__ = type
|
||||
|
||||
import os
|
||||
import shlex
|
||||
|
||||
from ansible_collections.containers.podman.plugins.module_utils.podman.common import compare_systemd_file_content
|
||||
|
||||
|
|
@ -169,9 +170,9 @@ class ContainerQuadlet(Quadlet):
|
|||
if isinstance(params["command"], list)
|
||||
else params["command"])
|
||||
if params["label"]:
|
||||
params["label"] = ["%s=%s" % (k, v) for k, v in params["label"].items()]
|
||||
params["label"] = [shlex.quote("%s=%s" % (k, v)) for k, v in params["label"].items()]
|
||||
if params["env"]:
|
||||
params["env"] = ["%s=%s" % (k, v) for k, v in params["env"].items()]
|
||||
params["env"] = [shlex.quote("%s=%s" % (k, v)) for k, v in params["env"].items()]
|
||||
if params["rootfs"]:
|
||||
params["rootfs"] = params["image"]
|
||||
params["image"] = None
|
||||
|
|
|
|||
|
|
@ -1293,9 +1293,11 @@
|
|||
BAR: foo
|
||||
TEST: 1
|
||||
BOOL: false
|
||||
WITH_SPACES: "a nice string"
|
||||
label:
|
||||
somelabel: labelvalue
|
||||
otheralbe: othervalue
|
||||
spacelabel: "a nice label"
|
||||
log_opt:
|
||||
max_size: 10mb
|
||||
path: /var/log/container/mycontainer.json
|
||||
|
|
@ -1347,9 +1349,11 @@
|
|||
- "Unmask=ALL"
|
||||
- "SecurityLabelFileType=usr_t"
|
||||
- "Environment=BOOL=False"
|
||||
- "Environment='WITH_SPACES=a nice string'"
|
||||
- "PublishPort=9001:8000"
|
||||
- "AddHost=host2:127.0.0.1"
|
||||
- "Label=somelabel=labelvalue"
|
||||
- "Label='spacelabel=a nice label'"
|
||||
- "WantedBy=default.target"
|
||||
- "GroupAdd=admin"
|
||||
- "GroupAdd=users"
|
||||
|
|
@ -1411,9 +1415,11 @@
|
|||
BAR: foo
|
||||
TEST: 1
|
||||
BOOL: false
|
||||
WITH_SPACES: "a nice string"
|
||||
label:
|
||||
somelabel: labelvalue
|
||||
otheralbe: othervalue
|
||||
spacelabel: "a nice label"
|
||||
log_opt:
|
||||
max_size: 10mb
|
||||
path: /var/log/container/mycontainer.json
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue