Fix module failing when no ports are exposed

This commit is contained in:
Chris Houseknecht 2016-07-12 12:37:38 -04:00 committed by Matt Clay
parent d8b752b3cf
commit 4002caf60e

View file

@ -126,7 +126,7 @@ options:
description: description:
- List of additional container ports to expose for port mappings or links. - List of additional container ports to expose for port mappings or links.
If the port is already exposed using EXPOSE in a Dockerfile, it does not If the port is already exposed using EXPOSE in a Dockerfile, it does not
need to be xposed again. need to be exposed again.
default: null default: null
required: false required: false
aliases: aliases:
@ -738,15 +738,13 @@ class TaskParameters(DockerBaseClass):
except ValueError as exc: except ValueError as exc:
self.fail("Failed to convert %s to bytes: %s" % (param_name, exc)) self.fail("Failed to convert %s to bytes: %s" % (param_name, exc))
if 'all' in (port.lower() if isinstance(port, basestring) else port for port in self.published_ports): self.publish_all_ports = False
self.published_ports = self._parse_publish_ports()
if self.published_ports == 'all':
self.publish_all_ports = True self.publish_all_ports = True
self.published_ports = None self.published_ports = None
self.ports = None
else:
self.publish_all_ports = False
self.published_ports = self._parse_publish_ports()
self.ports = self._parse_exposed_ports(self.published_ports)
self.ports = self._parse_exposed_ports(self.published_ports)
self.log("expose ports:") self.log("expose ports:")
self.log(self.ports, pretty_print=True) self.log(self.ports, pretty_print=True)