docker_container: fix problem with published_ports idempotency (#46595)

* Fix comparisons for expected_ports (set vs dict).

* Added changelog.

(cherry picked from commit c5ea3d058e)
This commit is contained in:
Felix Fontein 2018-10-08 09:41:15 +02:00 committed by Toshio Kuratomi
parent 10fd0251e8
commit 4ffc75ab44
2 changed files with 4 additions and 1 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- "docker_container - fix idempotency check for published_ports in some special cases."

View file

@ -1249,7 +1249,7 @@ class Container(DockerBaseClass):
self.parameters.expected_env = None
self.parameters_map = dict()
self.parameters_map['expected_links'] = 'links'
self.parameters_map['expected_ports'] = 'published_ports'
self.parameters_map['expected_ports'] = 'expected_ports'
self.parameters_map['expected_exposed'] = 'exposed_ports'
self.parameters_map['expected_volumes'] = 'volumes'
self.parameters_map['expected_ulimits'] = 'ulimits'
@ -2180,6 +2180,7 @@ class AnsibleDockerClientContainer(AnsibleDockerClient):
comparisons['image']['comparison'] = 'ignore'
# Add implicit options
comparisons['publish_all_ports'] = dict(type='value', comparison='strict', name='published_ports')
comparisons['expected_ports'] = dict(type='dict', comparison=comparisons['published_ports']['comparison'], name='expected_ports')
self.comparisons = comparisons
def __init__(self, **kwargs):