Fix ansible-test docker container IP detection.
This commit is contained in:
parent
6119fb0a9a
commit
14ff5e213c
2 changed files with 9 additions and 1 deletions
|
@ -0,0 +1,2 @@
|
||||||
|
bugfixes:
|
||||||
|
- ansible-test - Fix docker container IP address detection. The ``bridge`` network is no longer assumed to be the default.
|
|
@ -423,7 +423,13 @@ class DockerInspect:
|
||||||
def get_ip_address(self): # type: () -> t.Optional[str]
|
def get_ip_address(self): # type: () -> t.Optional[str]
|
||||||
"""Return the IP address of the container for the preferred docker network."""
|
"""Return the IP address of the container for the preferred docker network."""
|
||||||
if self.networks:
|
if self.networks:
|
||||||
network_name = get_docker_preferred_network_name(self.args) or 'bridge'
|
network_name = get_docker_preferred_network_name(self.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(self.networks.keys()).pop(0)
|
||||||
|
|
||||||
ipaddress = self.networks[network_name]['IPAddress']
|
ipaddress = self.networks[network_name]['IPAddress']
|
||||||
else:
|
else:
|
||||||
ipaddress = self.network_settings['IPAddress']
|
ipaddress = self.network_settings['IPAddress']
|
||||||
|
|
Loading…
Reference in a new issue