[stable-2.9] Fix ansible-test docker container IP detection. (#74390)
(cherry picked from commit 14ff5e213c)
Co-authored-by: Matt Clay <matt@mystile.com>
This commit is contained in:
@ -0,0 +1,2 @@
|
||||
bugfixes:
|
||||
- ansible-test - Fix docker container IP address detection. The ``bridge`` network is no longer assumed to be the default.
|
||||
@ -106,7 +106,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
|
||||
|
||||
Reference in New Issue
Block a user