upgrading azure-mgmt-compute to the latest (#47601)

* upgrading azure-mgmt-compute to the latest
pull/48591/head
Zim Kalinowski 6 years ago committed by GitHub
parent 60dcfc3a09
commit 406da7a568
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -55,11 +55,11 @@ AZURE_API_PROFILES = {
'latest': { 'latest': {
'ContainerInstanceManagementClient': '2018-02-01-preview', 'ContainerInstanceManagementClient': '2018-02-01-preview',
'ComputeManagementClient': dict( 'ComputeManagementClient': dict(
default_api_version='2017-12-01', default_api_version='2018-10-01',
resource_skus='2017-09-01', resource_skus='2018-10-01',
disks='2017-03-30', disks='2018-10-01',
snapshots='2017-03-30', snapshots='2018-10-01',
virtual_machine_run_commands='2017-03-30' virtual_machine_run_commands='2018-10-01'
), ),
'NetworkManagementClient': '2018-08-01', 'NetworkManagementClient': '2018-08-01',
'ResourceManagementClient': '2017-05-10', 'ResourceManagementClient': '2017-05-10',
@ -204,7 +204,7 @@ AZURE_PKG_VERSIONS = {
}, },
'ComputeManagementClient': { 'ComputeManagementClient': {
'package_name': 'compute', 'package_name': 'compute',
'expected_version': '3.0.0' 'expected_version': '4.3.1'
}, },
'ContainerInstanceManagementClient': { 'ContainerInstanceManagementClient': {
'package_name': 'containerinstance', 'package_name': 'containerinstance',

@ -179,14 +179,16 @@ class AzureRMImage(AzureRMModuleBase):
if vm: if vm:
if self.data_disk_sources: if self.data_disk_sources:
self.fail('data_disk_sources is not allowed when capturing image from vm') 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: else:
if not self.os_type: if not self.os_type:
self.fail('os_type is required to create the image') self.fail('os_type is required to create the image')
os_disk = self.create_os_disk() os_disk = self.create_os_disk()
data_disks = self.create_data_disks() data_disks = self.create_data_disks()
storage_profile = self.compute_models.ImageStorageProfile(os_disk=os_disk, data_disks=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 # finally make the change if not check mode
if not self.check_mode and image_instance: if not self.check_mode and image_instance:
@ -236,8 +238,8 @@ class AzureRMImage(AzureRMModuleBase):
def create_os_disk(self): def create_os_disk(self):
blob_uri, disk, snapshot = self.resolve_storage_source(self.source) blob_uri, disk, snapshot = self.resolve_storage_source(self.source)
snapshot_resource = self.compute_models.SubResource(snapshot) if snapshot else None snapshot_resource = self.compute_models.SubResource(id=snapshot) if snapshot else None
managed_disk = self.compute_models.SubResource(disk) if disk else None managed_disk = self.compute_models.SubResource(id=disk) if disk else None
return self.compute_models.ImageOSDisk(os_type=self.os_type, return self.compute_models.ImageOSDisk(os_type=self.os_type,
os_state=self.compute_models.OperatingSystemStateTypes.generalized, os_state=self.compute_models.OperatingSystemStateTypes.generalized,
snapshot=snapshot_resource, snapshot=snapshot_resource,
@ -247,8 +249,8 @@ class AzureRMImage(AzureRMModuleBase):
def create_data_disk(self, lun, source): def create_data_disk(self, lun, source):
blob_uri, disk, snapshot = self.resolve_storage_source(source) blob_uri, disk, snapshot = self.resolve_storage_source(source)
if blob_uri or disk or snapshot: if blob_uri or disk or snapshot:
snapshot_resource = self.compute_models.SubResource(snapshot) if snapshot else None snapshot_resource = self.compute_models.SubResource(id=snapshot) if snapshot else None
managed_disk = self.compute_models.SubResource(disk) if disk else None managed_disk = self.compute_models.SubResource(id=disk) if disk else None
return self.compute_models.ImageDataDisk(lun, return self.compute_models.ImageDataDisk(lun,
blob_uri=blob_uri, blob_uri=blob_uri,
snapshot=snapshot_resource, snapshot=snapshot_resource,

@ -290,7 +290,7 @@ class AzureRMManagedDisk(AzureRMModuleBase):
# prepare the data disk # prepare the data disk
params = self.compute_models.ManagedDiskParameters(id=disk.get('id'), storage_account_type=disk.get('storage_account_type')) 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) vm.storage_profile.data_disks.append(data_disk)
self._update_vm(vm_name, vm) self._update_vm(vm_name, vm)
@ -321,7 +321,7 @@ class AzureRMManagedDisk(AzureRMModuleBase):
disk_params['location'] = self.location disk_params['location'] = self.location
disk_params['tags'] = self.tags disk_params['tags'] = self.tags
if self.storage_account_type: 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['sku'] = storage_account_type
disk_params['disk_size_gb'] = self.disk_size_gb disk_params['disk_size_gb'] = self.disk_size_gb
# TODO: Add support for EncryptionSettings # TODO: Add support for EncryptionSettings

@ -999,7 +999,7 @@ class AzureRMVirtualMachine(AzureRMModuleBase):
parsed_availability_set = parse_resource_id(self.availability_set) parsed_availability_set = parse_resource_id(self.availability_set)
availability_set = self.get_availability_set(parsed_availability_set.get('resource_group', self.resource_group), availability_set = self.get_availability_set(parsed_availability_set.get('resource_group', self.resource_group),
parsed_availability_set.get('name')) 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 # Get defaults
if not self.network_interface_names: if not self.network_interface_names:
@ -1044,7 +1044,7 @@ class AzureRMVirtualMachine(AzureRMModuleBase):
promotion_code=self.plan.get('promotion_code')) promotion_code=self.plan.get('promotion_code'))
vm_resource = self.compute_models.VirtualMachine( vm_resource = self.compute_models.VirtualMachine(
self.location, location=self.location,
tags=self.tags, tags=self.tags,
os_profile=self.compute_models.OSProfile( os_profile=self.compute_models.OSProfile(
admin_username=self.admin_username, admin_username=self.admin_username,
@ -1187,13 +1187,13 @@ class AzureRMVirtualMachine(AzureRMModuleBase):
availability_set_resource = None availability_set_resource = None
try: 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: except Exception:
# pass if the availability set is not set # pass if the availability set is not set
pass pass
vm_resource = self.compute_models.VirtualMachine( vm_resource = self.compute_models.VirtualMachine(
vm_dict['location'], location=vm_dict['location'],
os_profile=self.compute_models.OSProfile( os_profile=self.compute_models.OSProfile(
admin_username=vm_dict['properties'].get('osProfile', {}).get('adminUsername'), admin_username=vm_dict['properties'].get('osProfile', {}).get('adminUsername'),
computer_name=vm_dict['properties'].get('osProfile', {}).get('computerName') computer_name=vm_dict['properties'].get('osProfile', {}).get('computerName')

@ -609,10 +609,10 @@ class AzureRMVirtualMachineScaleSet(AzureRMModuleBase):
load_balancer_inbound_nat_pools = None load_balancer_inbound_nat_pools = None
if self.load_balancer: if self.load_balancer:
load_balancer = self.get_load_balancer(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] for resource in load_balancer.backend_address_pools]
if load_balancer.backend_address_pools else None) 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] for resource in load_balancer.inbound_nat_pools]
if load_balancer.inbound_nat_pools else None) 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')) self.security_group = self.network_models.NetworkSecurityGroup(id=nsg.get('id'))
vmss_resource = self.compute_models.VirtualMachineScaleSet( vmss_resource = self.compute_models.VirtualMachineScaleSet(
self.location, location=self.location,
tags=self.tags, tags=self.tags,
upgrade_policy=self.compute_models.UpgradePolicy( upgrade_policy=self.compute_models.UpgradePolicy(
mode=self.upgrade_policy mode=self.upgrade_policy

@ -5,7 +5,7 @@ azure-cli-nspkg==3.0.2
azure-common==1.1.11 azure-common==1.1.11
azure-mgmt-batch==4.1.0 azure-mgmt-batch==4.1.0
azure-mgmt-cdn==3.0.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-containerinstance==0.4.0
azure-mgmt-containerregistry==2.0.0 azure-mgmt-containerregistry==2.0.0
azure-mgmt-containerservice==3.0.1 azure-mgmt-containerservice==3.0.1

@ -5,7 +5,7 @@ azure-cli-nspkg==3.0.2
azure-common==1.1.11 azure-common==1.1.11
azure-mgmt-batch==4.1.0 azure-mgmt-batch==4.1.0
azure-mgmt-cdn==3.0.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-containerinstance==0.4.0
azure-mgmt-containerregistry==2.0.0 azure-mgmt-containerregistry==2.0.0
azure-mgmt-containerservice==3.0.1 azure-mgmt-containerservice==3.0.1

Loading…
Cancel
Save