fixing container instance sanity & integration tests (#40774)

This commit is contained in:
Zim Kalinowski 2018-05-28 12:59:26 +08:00 committed by Yunge Zhu
parent bf5cd98a2b
commit dde48560fb
5 changed files with 14 additions and 13 deletions

View file

@ -50,6 +50,7 @@ options:
choices: choices:
- public - public
- none - none
default: 'none'
ports: ports:
description: description:
- List of ports exposed within the container group. - List of ports exposed within the container group.
@ -144,6 +145,7 @@ from ansible.module_utils.azure_rm_common import AzureRMModuleBase
try: try:
from msrestazure.azure_exceptions import CloudError from msrestazure.azure_exceptions import CloudError
from msrestazure.azure_operation import AzureOperationPoller
from azure.mgmt.containerinstance import ContainerInstanceManagementClient from azure.mgmt.containerinstance import ContainerInstanceManagementClient
except ImportError: except ImportError:
# This is handled in azure_rm_common # This is handled in azure_rm_common
@ -382,6 +384,9 @@ class AzureRMContainerInstance(AzureRMModuleBase):
container_group_name=self.name, container_group_name=self.name,
container_group=parameters) container_group=parameters)
if isinstance(response, AzureOperationPoller):
response = self.get_poller_result(response)
return response.as_dict() return response.as_dict()
def delete_containerinstance(self): def delete_containerinstance(self):

View file

@ -16,4 +16,4 @@ azure-mgmt-web>=0.32.0,<0.33
azure-mgmt-containerservice>=3.0.1 azure-mgmt-containerservice>=3.0.1
azure-mgmt-containerregistry>=1.0.1 azure-mgmt-containerregistry>=1.0.1
azure-mgmt-rdbms>=0.2.0rc1,<0.3.0 azure-mgmt-rdbms>=0.2.0rc1,<0.3.0
azure-mgmt-containerinstance>=0.3.1,<0.4.0 azure-mgmt-containerinstance==0.4.0

View file

@ -14,18 +14,18 @@
ports: ports:
- 80 - 80
- 81 - 81
- name: mycontainer2
image: httpd
memory: 1.5
register: output register: output
- debug:
var: output
- name: Assert the container instance is well created - name: Assert the container instance is well created
assert: assert:
that: that:
- output.changed - 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: azure_rm_containerinstance:
resource_group: "{{ resource_group }}" resource_group: "{{ resource_group }}"
name: "aci{{ resource_group | hash('md5') | truncate(7, True, '') }}" name: "aci{{ resource_group | hash('md5') | truncate(7, True, '') }}"
@ -41,9 +41,6 @@
ports: ports:
- 80 - 80
- 81 - 81
- name: mycontainer2
image: httpd
memory: 1.5
register: output register: output
- name: Assert the container instance is well created - name: Assert the container instance is well created
@ -51,7 +48,7 @@
that: that:
- output.changed == False - output.changed == False
- name: Create sample container instance - name: Create sample container instance -- force update
azure_rm_containerinstance: azure_rm_containerinstance:
resource_group: "{{ resource_group }}" resource_group: "{{ resource_group }}"
name: "aci{{ resource_group | hash('md5') | truncate(7, True, '') }}" name: "aci{{ resource_group | hash('md5') | truncate(7, True, '') }}"
@ -74,7 +71,7 @@
assert: assert:
that: that:
- output.changed - output.changed
- output.provisioning_state == 'Creating' - output.provisioning_state == 'Succeeded'
- name: Remove container instance - name: Remove container instance
azure_rm_containerinstance: azure_rm_containerinstance:

View file

@ -16,4 +16,4 @@ azure-mgmt-web>=0.32.0,<0.33
azure-mgmt-containerservice>=3.0.1 azure-mgmt-containerservice>=3.0.1
azure-mgmt-containerregistry>=1.0.1 azure-mgmt-containerregistry>=1.0.1
azure-mgmt-rdbms>=0.2.0rc1,<0.3.0 azure-mgmt-rdbms>=0.2.0rc1,<0.3.0
azure-mgmt-containerinstance>=0.3.1,<0.4.0 azure-mgmt-containerinstance==0.4.0

View file

@ -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/atomic/atomic_container.py E326
lib/ansible/modules/cloud/azure/_azure.py E324 lib/ansible/modules/cloud/azure/_azure.py E324
lib/ansible/modules/cloud/azure/_azure.py E326 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_alert_policy.py E317
lib/ansible/modules/cloud/centurylink/clc_firewall_policy.py E317 lib/ansible/modules/cloud/centurylink/clc_firewall_policy.py E317
lib/ansible/modules/cloud/centurylink/clc_firewall_policy.py E324 lib/ansible/modules/cloud/centurylink/clc_firewall_policy.py E324