[stable-2.10] Fix container discovery for the acme test plugin.

(cherry picked from commit f022dedd0a)

Co-authored-by: Matt Clay <matt@mystile.com>
This commit is contained in:
Matt Clay 2020-11-09 12:53:11 -08:00
parent 5bd0df7621
commit 8f767f7180
2 changed files with 8 additions and 4 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- ansible-test - Fix container hostname/IP discovery for the ``acme`` test plugin.

View file

@ -135,7 +135,7 @@ class ACMEProvider(CloudProvider):
else: else:
display.info('Starting a new ACME docker test container.', verbosity=1) display.info('Starting a new ACME docker test container.', verbosity=1)
if not self.args.docker and not container_id: if not container_id:
# publish the simulator ports when not running inside docker # publish the simulator ports when not running inside docker
publish_ports = [ publish_ports = [
'-p', '5000:5000', # control port for flask app in container '-p', '5000:5000', # control port for flask app in container
@ -155,14 +155,16 @@ class ACMEProvider(CloudProvider):
if self.args.docker: if self.args.docker:
acme_host = self.DOCKER_SIMULATOR_NAME acme_host = self.DOCKER_SIMULATOR_NAME
acme_host_ip = self._get_simulator_address()
elif container_id: elif container_id:
acme_host = self._get_simulator_address() acme_host = self._get_simulator_address()
acme_host_ip = acme_host
display.info('Found ACME test container address: %s' % acme_host, verbosity=1) display.info('Found ACME test container address: %s' % acme_host, verbosity=1)
else: else:
acme_host = get_docker_hostname() acme_host = get_docker_hostname()
acme_host_ip = acme_host
if container_id:
acme_host_ip = self._get_simulator_address()
else:
acme_host_ip = get_docker_hostname()
self._set_cloud_config('acme_host', acme_host) self._set_cloud_config('acme_host', acme_host)