From dde48560fbd739818e640257ec19b8be5a6be5be Mon Sep 17 00:00:00 2001 From: Zim Kalinowski Date: Mon, 28 May 2018 12:59:26 +0800 Subject: [PATCH] fixing container instance sanity & integration tests (#40774) --- .../cloud/azure/azure_rm_containerinstance.py | 5 +++++ packaging/requirements/requirements-azure.txt | 2 +- .../azure_rm_containerinstance/tasks/main.yml | 17 +++++++---------- .../requirements/integration.cloud.azure.txt | 2 +- test/sanity/validate-modules/ignore.txt | 1 - 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/lib/ansible/modules/cloud/azure/azure_rm_containerinstance.py b/lib/ansible/modules/cloud/azure/azure_rm_containerinstance.py index 53fff0573c..78478d8842 100644 --- a/lib/ansible/modules/cloud/azure/azure_rm_containerinstance.py +++ b/lib/ansible/modules/cloud/azure/azure_rm_containerinstance.py @@ -50,6 +50,7 @@ options: choices: - public - none + default: 'none' ports: description: - List of ports exposed within the container group. @@ -144,6 +145,7 @@ from ansible.module_utils.azure_rm_common import AzureRMModuleBase try: from msrestazure.azure_exceptions import CloudError + from msrestazure.azure_operation import AzureOperationPoller from azure.mgmt.containerinstance import ContainerInstanceManagementClient except ImportError: # This is handled in azure_rm_common @@ -382,6 +384,9 @@ class AzureRMContainerInstance(AzureRMModuleBase): container_group_name=self.name, container_group=parameters) + if isinstance(response, AzureOperationPoller): + response = self.get_poller_result(response) + return response.as_dict() def delete_containerinstance(self): diff --git a/packaging/requirements/requirements-azure.txt b/packaging/requirements/requirements-azure.txt index 802cb5d0d9..a4b61f8486 100644 --- a/packaging/requirements/requirements-azure.txt +++ b/packaging/requirements/requirements-azure.txt @@ -16,4 +16,4 @@ azure-mgmt-web>=0.32.0,<0.33 azure-mgmt-containerservice>=3.0.1 azure-mgmt-containerregistry>=1.0.1 azure-mgmt-rdbms>=0.2.0rc1,<0.3.0 -azure-mgmt-containerinstance>=0.3.1,<0.4.0 +azure-mgmt-containerinstance==0.4.0 diff --git a/test/integration/targets/azure_rm_containerinstance/tasks/main.yml b/test/integration/targets/azure_rm_containerinstance/tasks/main.yml index f9a38320f3..ef85a23f75 100644 --- a/test/integration/targets/azure_rm_containerinstance/tasks/main.yml +++ b/test/integration/targets/azure_rm_containerinstance/tasks/main.yml @@ -14,18 +14,18 @@ ports: - 80 - 81 - - name: mycontainer2 - image: httpd - memory: 1.5 register: output +- debug: + var: output + - name: Assert the container instance is well created assert: that: - output.changed - - output.provisioning_state == 'Creating' + - output.provisioning_state == 'Succeeded' -- name: Create sample container instance +- name: Create sample container instance -- same parameters azure_rm_containerinstance: resource_group: "{{ resource_group }}" name: "aci{{ resource_group | hash('md5') | truncate(7, True, '') }}" @@ -41,9 +41,6 @@ ports: - 80 - 81 - - name: mycontainer2 - image: httpd - memory: 1.5 register: output - name: Assert the container instance is well created @@ -51,7 +48,7 @@ that: - output.changed == False -- name: Create sample container instance +- name: Create sample container instance -- force update azure_rm_containerinstance: resource_group: "{{ resource_group }}" name: "aci{{ resource_group | hash('md5') | truncate(7, True, '') }}" @@ -74,7 +71,7 @@ assert: that: - output.changed - - output.provisioning_state == 'Creating' + - output.provisioning_state == 'Succeeded' - name: Remove container instance azure_rm_containerinstance: diff --git a/test/runner/requirements/integration.cloud.azure.txt b/test/runner/requirements/integration.cloud.azure.txt index 802cb5d0d9..a4b61f8486 100644 --- a/test/runner/requirements/integration.cloud.azure.txt +++ b/test/runner/requirements/integration.cloud.azure.txt @@ -16,4 +16,4 @@ azure-mgmt-web>=0.32.0,<0.33 azure-mgmt-containerservice>=3.0.1 azure-mgmt-containerregistry>=1.0.1 azure-mgmt-rdbms>=0.2.0rc1,<0.3.0 -azure-mgmt-containerinstance>=0.3.1,<0.4.0 +azure-mgmt-containerinstance==0.4.0 diff --git a/test/sanity/validate-modules/ignore.txt b/test/sanity/validate-modules/ignore.txt index 4718a24518..5aa7e7ce7f 100644 --- a/test/sanity/validate-modules/ignore.txt +++ b/test/sanity/validate-modules/ignore.txt @@ -145,7 +145,6 @@ lib/ansible/modules/cloud/atomic/atomic_container.py E317 lib/ansible/modules/cloud/atomic/atomic_container.py E326 lib/ansible/modules/cloud/azure/_azure.py E324 lib/ansible/modules/cloud/azure/_azure.py E326 -lib/ansible/modules/cloud/azure/azure_rm_containerinstance.py E324 lib/ansible/modules/cloud/centurylink/clc_alert_policy.py E317 lib/ansible/modules/cloud/centurylink/clc_firewall_policy.py E317 lib/ansible/modules/cloud/centurylink/clc_firewall_policy.py E324