From b15ceee6bd5c7b5db986808b5cb93f1b53ef9641 Mon Sep 17 00:00:00 2001 From: Chris Houseknecht Date: Fri, 10 Mar 2017 23:46:07 -0500 Subject: [PATCH] Changes command and entrypoint to type list --- .../modules/cloud/docker/docker_container.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/ansible/modules/cloud/docker/docker_container.py b/lib/ansible/modules/cloud/docker/docker_container.py index 8d2239f59a..c0fc651c3c 100644 --- a/lib/ansible/modules/cloud/docker/docker_container.py +++ b/lib/ansible/modules/cloud/docker/docker_container.py @@ -574,7 +574,7 @@ EXAMPLES = ''' docker_container: name: sleepy image: ubuntu:14.04 - command: sleep infinity + command: ["sleep", "infinity"] - name: Add container to networks docker_container: @@ -801,6 +801,14 @@ class TaskParameters(DockerBaseClass): if network.get('links'): network['links'] = self._parse_links(network['links']) + if self.entrypoint: + # convert from list to str. + self.entrypoint = ' '.join([str(x) for x in self.entrypoint]) + + if self.command: + # convert from list to str + self.command = ' '.join([str(x) for x in self.command]) + def fail(self, msg): self.client.module.fail_json(msg=msg) @@ -1483,7 +1491,6 @@ class Container(DockerBaseClass): return expected_devices def _get_expected_entrypoint(self): - self.log('_get_expected_entrypoint') if not self.parameters.entrypoint: return None return shlex.split(self.parameters.entrypoint) @@ -1940,7 +1947,7 @@ def main(): blkio_weight=dict(type='int'), capabilities=dict(type='list'), cleanup=dict(type='bool', default=False), - command=dict(type='str'), + command=dict(type='list'), cpu_period=dict(type='int'), cpu_quota=dict(type='int'), cpuset_cpus=dict(type='str'), @@ -1953,7 +1960,7 @@ def main(): dns_search_domains=dict(type='list'), env=dict(type='dict'), env_file=dict(type='path'), - entrypoint=dict(type='str'), + entrypoint=dict(type='list'), etc_hosts=dict(type='dict'), exposed_ports=dict(type='list', aliases=['exposed', 'expose']), force_kill=dict(type='bool', default=False, aliases=['forcekill']),