Overhaul ansible-test cloud test plugins. (#53044)

This commit is contained in:
Matt Clay 2019-02-28 18:25:49 -08:00 committed by GitHub
parent 9c644d9bcc
commit eeaff731de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
34 changed files with 338 additions and 211 deletions

View file

@ -16,6 +16,7 @@ from lib.util import (
from lib.cloud import (
CloudProvider,
CloudEnvironment,
CloudEnvironmentConfig,
)
from lib.core_ci import (
@ -29,7 +30,7 @@ class TowerCloudProvider(CloudProvider):
"""
:type args: TestConfig
"""
super(TowerCloudProvider, self).__init__(args, config_extension='.cfg')
super(TowerCloudProvider, self).__init__(args)
self.aci = None
self.version = ''
@ -162,14 +163,20 @@ class TowerCloudEnvironment(CloudEnvironment):
time.sleep(5)
def configure_environment(self, env, cmd):
"""Configuration which should be done once for each test target.
:type env: dict[str, str]
:type cmd: list[str]
def get_environment_config(self):
"""
:rtype: CloudEnvironmentConfig
"""
config = TowerConfig.parse(self.config_path)
env.update(config.environment)
env_vars = config.environment
ansible_vars = dict((key.lower(), value) for key, value in env_vars.items())
return CloudEnvironmentConfig(
env_vars=env_vars,
ansible_vars=ansible_vars,
)
class TowerConfig(object):
@ -213,7 +220,7 @@ class TowerConfig(object):
'password',
)
values = dict((k, parser.get('general', k)) for k in keys)
values = dict((k, parser.get('default', k)) for k in keys)
config = TowerConfig(values)
missing = [k for k in keys if not values.get(k)]