mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
Overhaul ansible-test cloud test plugins. (#53044)
This commit is contained in:
@@ -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)]
|
||||
|
||||
Reference in New Issue
Block a user