[stable-2.10] Fix ansible-test docker container IP detection.. (#74389)

(cherry picked from commit 14ff5e213c)

Co-authored-by: Matt Clay <matt@mystile.com>
pull/74307/head
Matt Clay 4 years ago committed by GitHub
parent 0d25d392aa
commit cb4209489f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
bugfixes:
- ansible-test - Fix docker container IP address detection. The ``bridge`` network is no longer assumed to be the default.

@ -110,7 +110,13 @@ def get_docker_container_ip(args, container_id):
networks = network_settings.get('Networks')
if networks:
network_name = get_docker_preferred_network_name(args) or 'bridge'
network_name = get_docker_preferred_network_name(args)
if not network_name:
# Sort networks and use the first available.
# This assumes all containers will have access to the same networks.
network_name = sorted(networks.keys()).pop(0)
ipaddress = networks[network_name]['IPAddress']
else:
# podman doesn't provide Networks, fall back to using IPAddress

Loading…
Cancel
Save