From 8a7d19788ca59309d9d82021952325736820e881 Mon Sep 17 00:00:00 2001 From: Marcin Date: Mon, 3 Dec 2018 08:09:03 +0100 Subject: Dont' attempt to remove drive if ID is "None" (#49423) --- lib/ansible/modules/cloud/azure/azure_rm_virtualmachine.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'lib/ansible/modules/cloud/azure') diff --git a/lib/ansible/modules/cloud/azure/azure_rm_virtualmachine.py b/lib/ansible/modules/cloud/azure/azure_rm_virtualmachine.py index b00c906cc4..b1ba5fc6e7 100644 --- a/lib/ansible/modules/cloud/azure/azure_rm_virtualmachine.py +++ b/lib/ansible/modules/cloud/azure/azure_rm_virtualmachine.py @@ -1431,10 +1431,11 @@ class AzureRMVirtualMachine(AzureRMModuleBase): data_disks = vm.storage_profile.data_disks for data_disk in data_disks: - if(data_disk.vhd): - vhd_uris.append(data_disk.vhd.uri) - elif(data_disk.managed_disk): - managed_disk_ids.append(data_disk.managed_disk.id) + if data_disk is not None: + if(data_disk.vhd): + vhd_uris.append(data_disk.vhd.uri) + elif(data_disk.managed_disk): + managed_disk_ids.append(data_disk.managed_disk.id) # FUTURE enable diff mode, move these there... self.log("VHD URIs to delete: {0}".format(', '.join(vhd_uris))) -- cgit v1.2.1