diff --git a/lib/ansible/module_utils/azure_rm_common.py b/lib/ansible/module_utils/azure_rm_common.py index f0cfa96000..46bbde54f3 100644 --- a/lib/ansible/module_utils/azure_rm_common.py +++ b/lib/ansible/module_utils/azure_rm_common.py @@ -55,11 +55,11 @@ AZURE_API_PROFILES = { 'latest': { 'ContainerInstanceManagementClient': '2018-02-01-preview', 'ComputeManagementClient': dict( - default_api_version='2017-12-01', - resource_skus='2017-09-01', - disks='2017-03-30', - snapshots='2017-03-30', - virtual_machine_run_commands='2017-03-30' + default_api_version='2018-10-01', + resource_skus='2018-10-01', + disks='2018-10-01', + snapshots='2018-10-01', + virtual_machine_run_commands='2018-10-01' ), 'NetworkManagementClient': '2018-08-01', 'ResourceManagementClient': '2017-05-10', @@ -204,7 +204,7 @@ AZURE_PKG_VERSIONS = { }, 'ComputeManagementClient': { 'package_name': 'compute', - 'expected_version': '3.0.0' + 'expected_version': '4.3.1' }, 'ContainerInstanceManagementClient': { 'package_name': 'containerinstance', diff --git a/lib/ansible/modules/cloud/azure/azure_rm_image.py b/lib/ansible/modules/cloud/azure/azure_rm_image.py index deb9b5dc15..6a9255140d 100644 --- a/lib/ansible/modules/cloud/azure/azure_rm_image.py +++ b/lib/ansible/modules/cloud/azure/azure_rm_image.py @@ -179,14 +179,16 @@ class AzureRMImage(AzureRMModuleBase): if vm: if self.data_disk_sources: self.fail('data_disk_sources is not allowed when capturing image from vm') - image_instance = self.compute_models.Image(self.location, source_virtual_machine=self.compute_models.SubResource(vm.id), tags=self.tags) + image_instance = self.compute_models.Image(location=self.location, + source_virtual_machine=self.compute_models.SubResource(id=vm.id), + tags=self.tags) else: if not self.os_type: self.fail('os_type is required to create the image') os_disk = self.create_os_disk() data_disks = self.create_data_disks() storage_profile = self.compute_models.ImageStorageProfile(os_disk=os_disk, data_disks=data_disks) - image_instance = self.compute_models.Image(self.location, storage_profile=storage_profile, tags=self.tags) + image_instance = self.compute_models.Image(location=self.location, storage_profile=storage_profile, tags=self.tags) # finally make the change if not check mode if not self.check_mode and image_instance: @@ -236,8 +238,8 @@ class AzureRMImage(AzureRMModuleBase): def create_os_disk(self): blob_uri, disk, snapshot = self.resolve_storage_source(self.source) - snapshot_resource = self.compute_models.SubResource(snapshot) if snapshot else None - managed_disk = self.compute_models.SubResource(disk) if disk else None + snapshot_resource = self.compute_models.SubResource(id=snapshot) if snapshot else None + managed_disk = self.compute_models.SubResource(id=disk) if disk else None return self.compute_models.ImageOSDisk(os_type=self.os_type, os_state=self.compute_models.OperatingSystemStateTypes.generalized, snapshot=snapshot_resource, @@ -247,8 +249,8 @@ class AzureRMImage(AzureRMModuleBase): def create_data_disk(self, lun, source): blob_uri, disk, snapshot = self.resolve_storage_source(source) if blob_uri or disk or snapshot: - snapshot_resource = self.compute_models.SubResource(snapshot) if snapshot else None - managed_disk = self.compute_models.SubResource(disk) if disk else None + snapshot_resource = self.compute_models.SubResource(id=snapshot) if snapshot else None + managed_disk = self.compute_models.SubResource(id=disk) if disk else None return self.compute_models.ImageDataDisk(lun, blob_uri=blob_uri, snapshot=snapshot_resource, diff --git a/lib/ansible/modules/cloud/azure/azure_rm_managed_disk.py b/lib/ansible/modules/cloud/azure/azure_rm_managed_disk.py index 06e9e8d1cc..3412d1f7b0 100644 --- a/lib/ansible/modules/cloud/azure/azure_rm_managed_disk.py +++ b/lib/ansible/modules/cloud/azure/azure_rm_managed_disk.py @@ -290,7 +290,7 @@ class AzureRMManagedDisk(AzureRMModuleBase): # prepare the data disk params = self.compute_models.ManagedDiskParameters(id=disk.get('id'), storage_account_type=disk.get('storage_account_type')) - data_disk = self.compute_models.DataDisk(lun, self.compute_models.DiskCreateOptionTypes.attach, managed_disk=params) + data_disk = self.compute_models.DataDisk(lun=lun, create_option=self.compute_models.DiskCreateOptionTypes.attach, managed_disk=params) vm.storage_profile.data_disks.append(data_disk) self._update_vm(vm_name, vm) @@ -321,7 +321,7 @@ class AzureRMManagedDisk(AzureRMModuleBase): disk_params['location'] = self.location disk_params['tags'] = self.tags if self.storage_account_type: - storage_account_type = self.compute_models.DiskSku(self.storage_account_type) + storage_account_type = self.compute_models.DiskSku(name=self.storage_account_type) disk_params['sku'] = storage_account_type disk_params['disk_size_gb'] = self.disk_size_gb # TODO: Add support for EncryptionSettings diff --git a/lib/ansible/modules/cloud/azure/azure_rm_virtualmachine.py b/lib/ansible/modules/cloud/azure/azure_rm_virtualmachine.py index 3df55a93b5..b00c906cc4 100644 --- a/lib/ansible/modules/cloud/azure/azure_rm_virtualmachine.py +++ b/lib/ansible/modules/cloud/azure/azure_rm_virtualmachine.py @@ -999,7 +999,7 @@ class AzureRMVirtualMachine(AzureRMModuleBase): parsed_availability_set = parse_resource_id(self.availability_set) availability_set = self.get_availability_set(parsed_availability_set.get('resource_group', self.resource_group), parsed_availability_set.get('name')) - availability_set_resource = self.compute_models.SubResource(availability_set.id) + availability_set_resource = self.compute_models.SubResource(id=availability_set.id) # Get defaults if not self.network_interface_names: @@ -1044,7 +1044,7 @@ class AzureRMVirtualMachine(AzureRMModuleBase): promotion_code=self.plan.get('promotion_code')) vm_resource = self.compute_models.VirtualMachine( - self.location, + location=self.location, tags=self.tags, os_profile=self.compute_models.OSProfile( admin_username=self.admin_username, @@ -1187,13 +1187,13 @@ class AzureRMVirtualMachine(AzureRMModuleBase): availability_set_resource = None try: - availability_set_resource = self.compute_models.SubResource(vm_dict['properties']['availabilitySet'].get('id')) + availability_set_resource = self.compute_models.SubResource(id=vm_dict['properties']['availabilitySet'].get('id')) except Exception: # pass if the availability set is not set pass vm_resource = self.compute_models.VirtualMachine( - vm_dict['location'], + location=vm_dict['location'], os_profile=self.compute_models.OSProfile( admin_username=vm_dict['properties'].get('osProfile', {}).get('adminUsername'), computer_name=vm_dict['properties'].get('osProfile', {}).get('computerName') diff --git a/lib/ansible/modules/cloud/azure/azure_rm_virtualmachine_scaleset.py b/lib/ansible/modules/cloud/azure/azure_rm_virtualmachine_scaleset.py index 21ab0a14ca..64d35755be 100644 --- a/lib/ansible/modules/cloud/azure/azure_rm_virtualmachine_scaleset.py +++ b/lib/ansible/modules/cloud/azure/azure_rm_virtualmachine_scaleset.py @@ -609,10 +609,10 @@ class AzureRMVirtualMachineScaleSet(AzureRMModuleBase): load_balancer_inbound_nat_pools = None if self.load_balancer: load_balancer = self.get_load_balancer(self.load_balancer) - load_balancer_backend_address_pools = ([self.compute_models.SubResource(resource.id) + load_balancer_backend_address_pools = ([self.compute_models.SubResource(id=resource.id) for resource in load_balancer.backend_address_pools] if load_balancer.backend_address_pools else None) - load_balancer_inbound_nat_pools = ([self.compute_models.SubResource(resource.id) + load_balancer_inbound_nat_pools = ([self.compute_models.SubResource(id=resource.id) for resource in load_balancer.inbound_nat_pools] if load_balancer.inbound_nat_pools else None) @@ -630,7 +630,7 @@ class AzureRMVirtualMachineScaleSet(AzureRMModuleBase): self.security_group = self.network_models.NetworkSecurityGroup(id=nsg.get('id')) vmss_resource = self.compute_models.VirtualMachineScaleSet( - self.location, + location=self.location, tags=self.tags, upgrade_policy=self.compute_models.UpgradePolicy( mode=self.upgrade_policy diff --git a/packaging/requirements/requirements-azure.txt b/packaging/requirements/requirements-azure.txt index 291d8c46e2..897749ab50 100644 --- a/packaging/requirements/requirements-azure.txt +++ b/packaging/requirements/requirements-azure.txt @@ -5,7 +5,7 @@ azure-cli-nspkg==3.0.2 azure-common==1.1.11 azure-mgmt-batch==4.1.0 azure-mgmt-cdn==3.0.0 -azure-mgmt-compute==3.0.0 +azure-mgmt-compute==4.3.1 azure-mgmt-containerinstance==0.4.0 azure-mgmt-containerregistry==2.0.0 azure-mgmt-containerservice==3.0.1 diff --git a/test/runner/requirements/integration.cloud.azure.txt b/test/runner/requirements/integration.cloud.azure.txt index 291d8c46e2..897749ab50 100644 --- a/test/runner/requirements/integration.cloud.azure.txt +++ b/test/runner/requirements/integration.cloud.azure.txt @@ -5,7 +5,7 @@ azure-cli-nspkg==3.0.2 azure-common==1.1.11 azure-mgmt-batch==4.1.0 azure-mgmt-cdn==3.0.0 -azure-mgmt-compute==3.0.0 +azure-mgmt-compute==4.3.1 azure-mgmt-containerinstance==0.4.0 azure-mgmt-containerregistry==2.0.0 azure-mgmt-containerservice==3.0.1