From a050d892d83bc4a763f9de0c34bb37bb12a64107 Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Sun, 26 Apr 2020 18:19:04 -0700 Subject: [PATCH] Remove obsolete vcenter setup from ansible-test. --- ...le-test-obsolete-vcenter-proivisioning.yml | 2 + .../ansible_test/_internal/cloud/vcenter.py | 63 ++----------------- test/lib/ansible_test/_internal/core_ci.py | 9 +-- 3 files changed, 7 insertions(+), 67 deletions(-) create mode 100644 changelogs/fragments/ansible-test-obsolete-vcenter-proivisioning.yml diff --git a/changelogs/fragments/ansible-test-obsolete-vcenter-proivisioning.yml b/changelogs/fragments/ansible-test-obsolete-vcenter-proivisioning.yml new file mode 100644 index 00000000000..c55bf8d8382 --- /dev/null +++ b/changelogs/fragments/ansible-test-obsolete-vcenter-proivisioning.yml @@ -0,0 +1,2 @@ +minor_changes: + - ansible-test - Remove obsolete support for provisioning remote vCenter instances. The supporting services are no longer available. diff --git a/test/lib/ansible_test/_internal/cloud/vcenter.py b/test/lib/ansible_test/_internal/cloud/vcenter.py index 2b84aa9a24f..eb387375b96 100644 --- a/test/lib/ansible_test/_internal/cloud/vcenter.py +++ b/test/lib/ansible_test/_internal/cloud/vcenter.py @@ -13,7 +13,6 @@ from . import ( from ..util import ( find_executable, display, - is_shippable, ConfigParser, ) @@ -25,10 +24,6 @@ from ..docker_util import ( get_docker_container_id, ) -from ..core_ci import ( - AnsibleCoreCI, -) - class VcenterProvider(CloudProvider): """VMware vcenter/esx plugin. Sets up cloud resources for tests.""" @@ -47,12 +42,9 @@ class VcenterProvider(CloudProvider): self.image = 'quay.io/ansible/vcenter-test-container:1.7.0' self.container_name = '' - # VMware tests can be run on govcsim or baremetal, either BYO with a static config - # file or hosted in worldstream. Using an env var value of 'worldstream' with appropriate - # CI credentials will deploy a dynamic baremetal environment. The simulator is the default - # if no other config if provided. + # VMware tests can be run on govcsim or BYO with a static config file. + # The simulator is the default if no config is provided. self.vmware_test_platform = os.environ.get('VMWARE_TEST_PLATFORM', 'govcsim') - self.aci = None self.insecure = False self.proxy = None self.platform = 'vcenter' @@ -80,16 +72,6 @@ class VcenterProvider(CloudProvider): return super(VcenterProvider, self).filter(targets, exclude) - elif self.vmware_test_platform == 'worldstream': - aci = self._create_ansible_core_ci() - - if os.path.isfile(aci.ci_key): - return - - if is_shippable(): - return - - super(VcenterProvider, self).filter(targets, exclude) def setup(self): """Setup the cloud resource before delegation and register a cleanup callback.""" @@ -99,9 +81,6 @@ class VcenterProvider(CloudProvider): if self.vmware_test_platform == 'govcsim': self._setup_dynamic_simulator() self.managed = True - elif self.vmware_test_platform == 'worldstream': - self._setup_dynamic_baremetal() - self.managed = True elif self.vmware_test_platform == 'static': self._use_static_config() self._setup_static() @@ -113,18 +92,13 @@ class VcenterProvider(CloudProvider): """Get any additional options needed when delegating tests to a docker container. :rtype: list[str] """ - if self.managed and self.vmware_test_platform != 'worldstream': + if self.managed: return ['--link', self.DOCKER_SIMULATOR_NAME] return [] def cleanup(self): """Clean up the cloud resource and any temporary configuration files after tests complete.""" - if self.vmware_test_platform == 'worldstream': - - if self.aci: - self.aci.stop() - if self.container_name: docker_rm(self.args, self.container_name) @@ -185,35 +159,6 @@ class VcenterProvider(CloudProvider): ipaddress = results[0]['NetworkSettings']['IPAddress'] return ipaddress - def _setup_dynamic_baremetal(self): - """Request Esxi credentials through the Ansible Core CI service.""" - display.info('Provisioning %s cloud environment.' % self.platform, - verbosity=1) - - config = self._read_config_template() - - aci = self._create_ansible_core_ci() - - if not self.args.explain: - self.aci = aci - aci.start() - aci.wait(iterations=160) - - data = aci.get().response_json.get('data') - for key, value in data.items(): - if key.endswith('PASSWORD'): - display.sensitive.add(value) - config = self._populate_config_template(config, data) - self._write_config(config) - - def _create_ansible_core_ci(self): - """ - :rtype: AnsibleCoreCI - """ - return AnsibleCoreCI(self.args, 'vmware', 'vmware', - persist=False, stage=self.args.remote_stage, - provider='vmware') - def _setup_static(self): if not os.path.exists(self.config_static_path): display.error('Configuration file does not exist: %s' % self.config_static_path) @@ -242,7 +187,7 @@ class VcenterEnvironment(CloudEnvironment): # We may be in a container, so we cannot just reach VMWARE_TEST_PLATFORM, # We do a try/except instead parser = ConfigParser() - parser.read(self.config_path) # Worldstream and static + parser.read(self.config_path) # static env_vars = dict() ansible_vars = dict( diff --git a/test/lib/ansible_test/_internal/core_ci.py b/test/lib/ansible_test/_internal/core_ci.py index 6c79609a0d3..aff55e51171 100644 --- a/test/lib/ansible_test/_internal/core_ci.py +++ b/test/lib/ansible_test/_internal/core_ci.py @@ -111,9 +111,6 @@ class AnsibleCoreCI: parallels=( 'osx', ), - vmware=( - 'vmware', - ), ) # Currently ansible-core-ci has no concept of arch selection. This effectively means each provider only supports one arch. @@ -193,10 +190,6 @@ class AnsibleCoreCI: self.ssh_key = SshKey(args) self.port = None - elif self.provider == 'vmware': - self.ssh_key = SshKey(args) - self.endpoints = ['https://access.ws.testing.ansible.com'] - self.max_threshold = 1 else: if self.arch: raise ApplicationError('Provider not detected for platform "%s" on arch "%s".' % (self.platform, self.arch)) @@ -368,7 +361,7 @@ class AnsibleCoreCI: password=con.get('password'), response_json=response_json, ) - else: # 'vcenter' resp does not have a 'connection' key + else: self.connection = InstanceConnection( running=status == 'running', response_json=response_json,