docker_container: fix container creation with networks_cli_compatible=yes (#56687)

* Fix behavior.

* Add changelog.

* Add simple test to prevent #56620.
pull/57042/head
Felix Fontein 5 years ago committed by ansibot
parent baac1df935
commit d8dcd20294

@ -0,0 +1,2 @@
bugfixes:
- "docker_container - fix network creation when ``networks_cli_compatible`` is enabled."

@ -1282,7 +1282,7 @@ class TaskParameters(DockerBaseClass):
if network.get(para):
params[para] = network[para]
network_config = dict()
network_config[network['name']] = self.client.create_endpoint_config(params)
network_config[network['name']] = self.client.create_endpoint_config(**params)
result['networking_config'] = self.client.create_networking_config(network_config)
return result

@ -260,6 +260,9 @@
state: started
networks:
- name: "{{ nname_1 }}"
aliases:
- alias1
- alias2
- name: "{{ nname_2 }}"
networks_cli_compatible: yes
register: networks_1

Loading…
Cancel
Save