mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00:00
Fix python 3 compatibility for network id lookup (#45467)
Due to a change in python 3 filters return filter instead of list. This breaks the network name to id lookup for the docker_swarm_module. By wrapping it in list it ensures it is a list when returned and the id is extracted.
This commit is contained in:
@@ -838,7 +838,7 @@ class DockerService(DockerBaseClass):
|
|||||||
for network_name in self.networks:
|
for network_name in self.networks:
|
||||||
network_id = None
|
network_id = None
|
||||||
try:
|
try:
|
||||||
network_id = filter(lambda n: n['name'] == network_name, docker_networks)[0]['id']
|
network_id = list(filter(lambda n: n['name'] == network_name, docker_networks))[0]['id']
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
if network_id:
|
if network_id:
|
||||||
|
|||||||
Reference in New Issue
Block a user