mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
docker_container: do not split command on commas (#24900)
* docker_container: do not split command on commas Fix issue #24430 * docker_container: document command parameter Prior behavior was strange, splitting strings on commas only to join them again ... replacing commas with spaces. FYI, docker-py accepts strings or lists, using shlex.split on strings ... splitting on spaces while respecting things like quotes. https://github.com/docker/docker-py/blob/master/docker/api/container.py https://github.com/docker/docker-py/blob/master/docker/types/containers.py https://github.com/docker/docker-py/blob/master/docker/utils/utils.py More info regarding Dockerfile syntax for CMD strings and lists can be found at https://docs.docker.com/engine/reference/builder/#cmd
This commit is contained in:
parent
f8e47e2204
commit
f5fd32eae6
1 changed files with 5 additions and 2 deletions
|
@ -59,6 +59,8 @@ options:
|
|||
command:
|
||||
description:
|
||||
- Command to execute when the container starts.
|
||||
A command may be either a string or a list.
|
||||
Prior to version 2.4, strings were split on commas.
|
||||
default: null
|
||||
required: false
|
||||
cpu_period:
|
||||
|
@ -814,7 +816,8 @@ class TaskParameters(DockerBaseClass):
|
|||
|
||||
if self.command:
|
||||
# convert from list to str
|
||||
self.command = ' '.join([str(x) for x in self.command])
|
||||
if isinstance(self.command, list):
|
||||
self.command = ' '.join([str(x) for x in self.command])
|
||||
|
||||
def fail(self, msg):
|
||||
self.client.module.fail_json(msg=msg)
|
||||
|
@ -1970,7 +1973,7 @@ def main():
|
|||
blkio_weight=dict(type='int'),
|
||||
capabilities=dict(type='list'),
|
||||
cleanup=dict(type='bool', default=False),
|
||||
command=dict(type='list'),
|
||||
command=dict(type='raw'),
|
||||
cpu_period=dict(type='int'),
|
||||
cpu_quota=dict(type='int'),
|
||||
cpuset_cpus=dict(type='str'),
|
||||
|
|
Loading…
Reference in a new issue