Fix docker hostname parsing in ansible-test (#86235)

* Fix docker hostname parsing in ansible-test

* add clog frag
pull/86239/head
sivel / Matt Martz 2 weeks ago committed by GitHub
parent 9d9a8d78ee
commit bff3a9aeb9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,2 @@
bugfixes:
- ansible-test - Fix docker hostname parsing

@ -507,7 +507,7 @@ def get_docker_hostname() -> str:
if docker_host and docker_host.startswith(('tcp://', 'ssh://')):
try:
hostname = urllib.parse.urlparse(docker_host)[1].split(':')[0]
hostname = urllib.parse.urlparse(docker_host).hostname
display.info('Detected Docker host: %s' % hostname, verbosity=1)
except ValueError:
hostname = 'localhost'
@ -516,7 +516,7 @@ def get_docker_hostname() -> str:
hostname = 'localhost'
display.info('Assuming Docker is available on localhost.', verbosity=1)
return hostname
return hostname or 'localhost'
@cache

Loading…
Cancel
Save