From 030dcccad464b4f8934d05996bb44c7e5ad17735 Mon Sep 17 00:00:00 2001 From: Chris Houseknecht Date: Mon, 11 Jul 2016 13:14:23 -0400 Subject: [PATCH] Fix multi-interface port binding. --- lib/ansible/modules/cloud/docker/docker_container.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/cloud/docker/docker_container.py b/lib/ansible/modules/cloud/docker/docker_container.py index 1abf2b806b0..30834a1992a 100644 --- a/lib/ansible/modules/cloud/docker/docker_container.py +++ b/lib/ansible/modules/cloud/docker/docker_container.py @@ -1410,7 +1410,7 @@ class Container(DockerBaseClass): return entrypoint def _get_expected_ports(self): - if self.parameters.published_ports is None: + if not self.parameters.published_ports: return None expected_bound_ports = {} for container_port, config in self.parameters.published_ports.iteritems(): @@ -1420,7 +1420,7 @@ class Container(DockerBaseClass): expected_bound_ports[container_port] = [{'HostIp': "0.0.0.0", 'HostPort': ""}] elif isinstance(config[0], tuple): expected_bound_ports[container_port] = [] - for host_ip, host_port in config.iteritems(): + for host_ip, host_port in config: expected_bound_ports[container_port].append({ 'HostIp': host_ip, 'HostPort': str(host_port)}) else: expected_bound_ports[container_port] = [{'HostIp': config[0], 'HostPort': str(config[1])}]