Merge pull request #2258 from SamYaple/fix_docker_bug_2257

Don't assume ExposedPorts exists (bug #2257)
This commit is contained in:
Brian Coca 2015-10-14 11:31:06 -04:00
commit 4c14e6267f

View file

@ -1062,11 +1062,11 @@ class DockerManager(object):
continue
# EXPOSED PORTS
expected_exposed_ports = set((image['ContainerConfig']['ExposedPorts'] or {}).keys())
expected_exposed_ports = set((image['ContainerConfig'].get('ExposedPorts') or {}).keys())
for p in (self.exposed_ports or []):
expected_exposed_ports.add("/".join(p))
actually_exposed_ports = set((container["Config"]["ExposedPorts"] or {}).keys())
actually_exposed_ports = set((container["Config"].get("ExposedPorts") or {}).keys())
if actually_exposed_ports != expected_exposed_ports:
self.reload_reasons.append('exposed_ports ({0} => {1})'.format(actually_exposed_ports, expected_exposed_ports))