{"action":"closed","issue":{"url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/2309","labels_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/2309/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/2309/comments","events_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/2309/events","html_url":"https://github.com/ansible/ansible-modules-core/issues/2309","id":112180201,"number":2309,"title":"Docker module fails on checking reload conditions","user":{"login":"olsaki","id":967278,"avatar_url":"https://avatars.githubusercontent.com/u/967278?v=3","gravatar_id":"","url":"https://api.github.com/users/olsaki","html_url":"https://github.com/olsaki","followers_url":"https://api.github.com/users/olsaki/followers","following_url":"https://api.github.com/users/olsaki/following{/other_user}","gists_url":"https://api.github.com/users/olsaki/gists{/gist_id}","starred_url":"https://api.github.com/users/olsaki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olsaki/subscriptions","organizations_url":"https://api.github.com/users/olsaki/orgs","repos_url":"https://api.github.com/users/olsaki/repos","events_url":"https://api.github.com/users/olsaki/events{/privacy}","received_events_url":"https://api.github.com/users/olsaki/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-19T16:19:27Z","updated_at":"2015-10-19T20:34:37Z","closed_at":"2015-10-19T20:34:36Z","body":"*Issue Type:* Bug Report\r\n\r\n\r\n*Ansible Version:* 1.9.2\r\n\r\n\r\n*Ansible Configuration:*\r\n```\r\n[defaults]\r\ntimeout = 120\r\ntransport = paramiko\r\nssh_args = -o ControlMaster=auto -o ControlPersist=1800s\r\nsudo_flags = -E -H\r\nhost_key_checking=False\r\ninventory=hosts/ec2.py\r\npipelining=False\r\nhash_behaviour=merge\r\ncallback_plugins = callback_plugins\r\nlibrary = modules\r\nroles_path = roles\r\n[ssh_connection]\r\ncontrol_path = %(directory)s/%%h-%%r\r\n```\r\n\r\n*Environment:* Ubuntu 14.04.3 LTS\r\n\r\n\r\n*Summary:*\r\n\r\nWe encountered a border case where Docker module fails with action reload while evaluating if conditions for reloading a container are met. This issue occurs when you have not specify exposed ports in the Docker image via the `EXPOSE` directive, but have exposed ports in the container via attributes. This will result in a `KeyError` while it tries to lookup `ExposedPorts` as a key in the `image[\"ContainerConfig\"]` dict.\r\n\r\n\r\n*Steps To Reproduce:*\r\n\r\n1) Run a Docker container with an exposed port from a Docker image without EXPOSE directive\r\n2) Use the Docker module with action reload on this container\r\n\r\n\r\n*Expected Results:*\r\n\r\nContainer should either be reloaded or nothing should happen if container has not changed.\r\n\r\n\r\n*Actual Results:*\r\n\r\n```\r\nResult from run 1 is: {'msg': 'Traceback (most recent call last):\\n File \"/home/instana/.ansible/tmp/ansible-tmp-1445259015.35-272051678584569/docker\", line 3132, in <module>\\n main()\\n File \"/home/instana/.ansible/tmp/ansible-tmp-1445259015.35-272051678584569/docker\", line 1496, in main\\n reloaded(manager, containers, count, name)\\n File \"/home/instana/.ansible/tmp/ansible-tmp-1445259015.35-272051678584569/docker\", line 1373, in reloaded\\n for container in manager.get_differing_containers():\\n File \"/home/instana/.ansible/tmp/ansible-tmp-1445259015.35-272051678584569/docker\", line 881, in get_differing_containers\\n expected_exposed_ports = set((image[\\'ContainerConfig\\'][\\'ExposedPorts\\'] or {}).keys())\\nKeyError: \\'ExposedPorts\\'\\n', 'failed': True, 'attempts': 1, 'parsed': False}\r\n```"}}