diff --git a/test/runner/lib/cloud/azure.py b/test/runner/lib/cloud/azure.py index 3597b21a9af..69c84a1543a 100644 --- a/test/runner/lib/cloud/azure.py +++ b/test/runner/lib/cloud/azure.py @@ -30,6 +30,14 @@ class AzureCloudProvider(CloudProvider): """Azure cloud provider plugin. Sets up cloud resources before delegation.""" SHERLOCK_CONFIG_PATH = os.path.expanduser('~/.ansible-sherlock-ci.cfg') + def __init__(self, args): + """ + :type args: TestConfig + """ + super(AzureCloudProvider, self).__init__(args) + + self.aci = None + def filter(self, targets, exclude): """Filter out the cloud tests when the necessary config and resources are not available. :type targets: tuple[TestTarget] @@ -60,6 +68,13 @@ class AzureCloudProvider(CloudProvider): get_config(self.config_path) # check required variables + def cleanup(self): + """Clean up the cloud resource and any temporary configuration files after tests complete.""" + if self.aci: + self.aci.stop() + + super(AzureCloudProvider, self).cleanup() + def _setup_dynamic(self): """Request Azure credentials through Sherlock.""" display.info('Provisioning %s cloud environment.' % self.platform, verbosity=1) @@ -95,6 +110,7 @@ class AzureCloudProvider(CloudProvider): if not self.args.explain: response = aci_result['azure'] + self.aci = aci if not self.args.explain: values = dict( @@ -114,7 +130,7 @@ class AzureCloudProvider(CloudProvider): """ :rtype: AnsibleCoreCI """ - return AnsibleCoreCI(self.args, 'azure', 'sherlock', persist=False, stage=self.args.remote_stage, provider=self.args.remote_provider) + return AnsibleCoreCI(self.args, 'azure', 'azure', persist=False, stage=self.args.remote_stage, provider=self.args.remote_provider) class AzureCloudEnvironment(CloudEnvironment): diff --git a/test/runner/lib/core_ci.py b/test/runner/lib/core_ci.py index 48679568620..e2ab360587a 100644 --- a/test/runner/lib/core_ci.py +++ b/test/runner/lib/core_ci.py @@ -64,7 +64,6 @@ class AnsibleCoreCI(object): providers = dict( aws=( 'aws', - 'azure', 'windows', 'freebsd', 'rhel', @@ -73,6 +72,7 @@ class AnsibleCoreCI(object): 'ios', ), azure=( + 'azure', ), parallels=( 'osx',