Skip to content

Commit

Permalink
azure_rm_virtualmachine: Protect against no diskSizeGB (#185)
Browse files Browse the repository at this point in the history
Disks `diskSizeGB` is not reported if the Virtual Machine is
deallocated.  Trying to fetch it is causing a `KeyError`. This guards
against that KeyError and then nulls out the key so it isn't set
incorrectly in the update call.
  • Loading branch information
UnwashedMeme authored Jul 9, 2020
1 parent e6d7d8c commit c5ad468
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion plugins/modules/azure_rm_virtualmachine.py
Original file line number Diff line number Diff line change
Expand Up @@ -1593,7 +1593,7 @@ def exec_module(self, **kwargs):
vhd=data_disk_vhd,
caching=data_disk.get('caching'),
create_option=data_disk.get('createOption'),
disk_size_gb=int(data_disk['diskSizeGB']),
disk_size_gb=int(data_disk.get('diskSizeGB', 0)) or None,
managed_disk=data_disk_managed_disk,
))
vm_resource.storage_profile.data_disks = data_disks
Expand Down

0 comments on commit c5ad468

Please sign in to comment.