Remove obsolete vcenter setup from ansible-test.
This commit is contained in:
parent
bd4fdb1ca2
commit
a050d892d8
3 changed files with 7 additions and 67 deletions
|
@ -0,0 +1,2 @@
|
||||||
|
minor_changes:
|
||||||
|
- ansible-test - Remove obsolete support for provisioning remote vCenter instances. The supporting services are no longer available.
|
|
@ -13,7 +13,6 @@ from . import (
|
||||||
from ..util import (
|
from ..util import (
|
||||||
find_executable,
|
find_executable,
|
||||||
display,
|
display,
|
||||||
is_shippable,
|
|
||||||
ConfigParser,
|
ConfigParser,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -25,10 +24,6 @@ from ..docker_util import (
|
||||||
get_docker_container_id,
|
get_docker_container_id,
|
||||||
)
|
)
|
||||||
|
|
||||||
from ..core_ci import (
|
|
||||||
AnsibleCoreCI,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class VcenterProvider(CloudProvider):
|
class VcenterProvider(CloudProvider):
|
||||||
"""VMware vcenter/esx plugin. Sets up cloud resources for tests."""
|
"""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.image = 'quay.io/ansible/vcenter-test-container:1.7.0'
|
||||||
self.container_name = ''
|
self.container_name = ''
|
||||||
|
|
||||||
# VMware tests can be run on govcsim or baremetal, either BYO with a static config
|
# VMware tests can be run on govcsim or BYO with a static config file.
|
||||||
# file or hosted in worldstream. Using an env var value of 'worldstream' with appropriate
|
# The simulator is the default if no config is provided.
|
||||||
# CI credentials will deploy a dynamic baremetal environment. The simulator is the default
|
|
||||||
# if no other config if provided.
|
|
||||||
self.vmware_test_platform = os.environ.get('VMWARE_TEST_PLATFORM', 'govcsim')
|
self.vmware_test_platform = os.environ.get('VMWARE_TEST_PLATFORM', 'govcsim')
|
||||||
self.aci = None
|
|
||||||
self.insecure = False
|
self.insecure = False
|
||||||
self.proxy = None
|
self.proxy = None
|
||||||
self.platform = 'vcenter'
|
self.platform = 'vcenter'
|
||||||
|
@ -80,16 +72,6 @@ class VcenterProvider(CloudProvider):
|
||||||
return
|
return
|
||||||
|
|
||||||
super(VcenterProvider, self).filter(targets, exclude)
|
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):
|
def setup(self):
|
||||||
"""Setup the cloud resource before delegation and register a cleanup callback."""
|
"""Setup the cloud resource before delegation and register a cleanup callback."""
|
||||||
|
@ -99,9 +81,6 @@ class VcenterProvider(CloudProvider):
|
||||||
if self.vmware_test_platform == 'govcsim':
|
if self.vmware_test_platform == 'govcsim':
|
||||||
self._setup_dynamic_simulator()
|
self._setup_dynamic_simulator()
|
||||||
self.managed = True
|
self.managed = True
|
||||||
elif self.vmware_test_platform == 'worldstream':
|
|
||||||
self._setup_dynamic_baremetal()
|
|
||||||
self.managed = True
|
|
||||||
elif self.vmware_test_platform == 'static':
|
elif self.vmware_test_platform == 'static':
|
||||||
self._use_static_config()
|
self._use_static_config()
|
||||||
self._setup_static()
|
self._setup_static()
|
||||||
|
@ -113,18 +92,13 @@ class VcenterProvider(CloudProvider):
|
||||||
"""Get any additional options needed when delegating tests to a docker container.
|
"""Get any additional options needed when delegating tests to a docker container.
|
||||||
:rtype: list[str]
|
:rtype: list[str]
|
||||||
"""
|
"""
|
||||||
if self.managed and self.vmware_test_platform != 'worldstream':
|
if self.managed:
|
||||||
return ['--link', self.DOCKER_SIMULATOR_NAME]
|
return ['--link', self.DOCKER_SIMULATOR_NAME]
|
||||||
|
|
||||||
return []
|
return []
|
||||||
|
|
||||||
def cleanup(self):
|
def cleanup(self):
|
||||||
"""Clean up the cloud resource and any temporary configuration files after tests complete."""
|
"""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:
|
if self.container_name:
|
||||||
docker_rm(self.args, self.container_name)
|
docker_rm(self.args, self.container_name)
|
||||||
|
|
||||||
|
@ -185,35 +159,6 @@ class VcenterProvider(CloudProvider):
|
||||||
ipaddress = results[0]['NetworkSettings']['IPAddress']
|
ipaddress = results[0]['NetworkSettings']['IPAddress']
|
||||||
return 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):
|
def _setup_static(self):
|
||||||
if not os.path.exists(self.config_static_path):
|
if not os.path.exists(self.config_static_path):
|
||||||
display.error('Configuration file does not exist: %s' % 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 may be in a container, so we cannot just reach VMWARE_TEST_PLATFORM,
|
||||||
# We do a try/except instead
|
# We do a try/except instead
|
||||||
parser = ConfigParser()
|
parser = ConfigParser()
|
||||||
parser.read(self.config_path) # Worldstream and static
|
parser.read(self.config_path) # static
|
||||||
|
|
||||||
env_vars = dict()
|
env_vars = dict()
|
||||||
ansible_vars = dict(
|
ansible_vars = dict(
|
||||||
|
|
|
@ -111,9 +111,6 @@ class AnsibleCoreCI:
|
||||||
parallels=(
|
parallels=(
|
||||||
'osx',
|
'osx',
|
||||||
),
|
),
|
||||||
vmware=(
|
|
||||||
'vmware',
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Currently ansible-core-ci has no concept of arch selection. This effectively means each provider only supports one arch.
|
# 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.ssh_key = SshKey(args)
|
||||||
self.port = None
|
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:
|
else:
|
||||||
if self.arch:
|
if self.arch:
|
||||||
raise ApplicationError('Provider not detected for platform "%s" on arch "%s".' % (self.platform, 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'),
|
password=con.get('password'),
|
||||||
response_json=response_json,
|
response_json=response_json,
|
||||||
)
|
)
|
||||||
else: # 'vcenter' resp does not have a 'connection' key
|
else:
|
||||||
self.connection = InstanceConnection(
|
self.connection = InstanceConnection(
|
||||||
running=status == 'running',
|
running=status == 'running',
|
||||||
response_json=response_json,
|
response_json=response_json,
|
||||||
|
|
Loading…
Reference in a new issue