diff options
author | Marcin <stolarek.marcin@gmail.com> | 2018-12-03 08:09:03 +0100 |
---|---|---|
committer | Zim Kalinowski <zikalino@microsoft.com> | 2018-12-03 15:09:03 +0800 |
commit | 8a7d19788ca59309d9d82021952325736820e881 (patch) | |
tree | cf618faa2525682ca411ce6ca9100ef6cc34667c /lib/ansible/modules/cloud/azure | |
parent | 7fcd55f3ece17f029c2480470a9025c1e54cf2c3 (diff) | |
download | ansible-8a7d19788ca59309d9d82021952325736820e881.tar.gz |
Dont' attempt to remove drive if ID is "None" (#49423)
Diffstat (limited to 'lib/ansible/modules/cloud/azure')
-rw-r--r-- | lib/ansible/modules/cloud/azure/azure_rm_virtualmachine.py | 9 |
1 files changed, 5 insertions, 4 deletions
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))) |