From 8f767f71804946fac8d88cafafc414ceab29603a Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Mon, 9 Nov 2020 12:53:11 -0800 Subject: [PATCH] [stable-2.10] Fix container discovery for the acme test plugin. (cherry picked from commit f022dedd0a37ffa5fbe39b6e9e8aac52d799ca7b) Co-authored-by: Matt Clay --- changelogs/fragments/ansible-test-acme-test-plugin.yml | 2 ++ test/lib/ansible_test/_internal/cloud/acme.py | 10 ++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 changelogs/fragments/ansible-test-acme-test-plugin.yml diff --git a/changelogs/fragments/ansible-test-acme-test-plugin.yml b/changelogs/fragments/ansible-test-acme-test-plugin.yml new file mode 100644 index 00000000000..7df85120eae --- /dev/null +++ b/changelogs/fragments/ansible-test-acme-test-plugin.yml @@ -0,0 +1,2 @@ +minor_changes: + - ansible-test - Fix container hostname/IP discovery for the ``acme`` test plugin. diff --git a/test/lib/ansible_test/_internal/cloud/acme.py b/test/lib/ansible_test/_internal/cloud/acme.py index 45bab7c0ef7..3d0ace24e7a 100644 --- a/test/lib/ansible_test/_internal/cloud/acme.py +++ b/test/lib/ansible_test/_internal/cloud/acme.py @@ -135,7 +135,7 @@ class ACMEProvider(CloudProvider): else: 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_ports = [ '-p', '5000:5000', # control port for flask app in container @@ -155,14 +155,16 @@ class ACMEProvider(CloudProvider): if self.args.docker: acme_host = self.DOCKER_SIMULATOR_NAME - acme_host_ip = self._get_simulator_address() elif container_id: acme_host = self._get_simulator_address() - acme_host_ip = acme_host display.info('Found ACME test container address: %s' % acme_host, verbosity=1) else: 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)