mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-21 00:19:09 -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
|
@ -7,11 +7,13 @@ import os
|
|||
|
||||
from lib.util import (
|
||||
display,
|
||||
ConfigParser,
|
||||
)
|
||||
|
||||
from lib.cloud import (
|
||||
CloudProvider,
|
||||
CloudEnvironment,
|
||||
CloudEnvironmentConfig,
|
||||
)
|
||||
|
||||
|
||||
|
@ -41,22 +43,19 @@ class GcpCloudProvider(CloudProvider):
|
|||
|
||||
class GcpCloudEnvironment(CloudEnvironment):
|
||||
"""GCP cloud environment plugin. Updates integration test environment after delegation."""
|
||||
def get_environment_config(self):
|
||||
"""
|
||||
:rtype: CloudEnvironmentConfig
|
||||
"""
|
||||
parser = ConfigParser()
|
||||
parser.read(self.config_path)
|
||||
|
||||
def configure_environment(self, env, cmd):
|
||||
"""
|
||||
:type env: dict[str, str]
|
||||
:type cmd: list[str]
|
||||
"""
|
||||
cmd.append('-e')
|
||||
cmd.append('@%s' % self.config_path)
|
||||
ansible_vars = dict(
|
||||
resource_prefix=self.resource_prefix,
|
||||
)
|
||||
|
||||
cmd.append('-e')
|
||||
cmd.append('resource_prefix=%s' % self.resource_prefix)
|
||||
ansible_vars.update(dict(parser.items('default')))
|
||||
|
||||
def on_failure(self, target, tries):
|
||||
"""
|
||||
:type target: TestTarget
|
||||
:type tries: int
|
||||
"""
|
||||
if not tries and self.managed:
|
||||
display.notice('%s failed' % target.name)
|
||||
return CloudEnvironmentConfig(
|
||||
ansible_vars=ansible_vars,
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue