mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-20 07:59:10 -07:00
Overhaul ansible-test cloud test plugins. (#53044)
This commit is contained in:
parent
9c644d9bcc
commit
eeaff731de
34 changed files with 338 additions and 211 deletions
|
@ -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)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue