From d6600b0ab69c76f4632c7a72bd71166fe085f5e3 Mon Sep 17 00:00:00 2001 From: Zim Kalinowski Date: Tue, 19 Feb 2019 10:20:50 +0800 Subject: [PATCH] fixed deallocated vm facts problem (#52540) --- .../modules/cloud/azure/azure_rm_virtualmachine_facts.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ansible/modules/cloud/azure/azure_rm_virtualmachine_facts.py b/lib/ansible/modules/cloud/azure/azure_rm_virtualmachine_facts.py index afffc37dd56..37dd0064455 100644 --- a/lib/ansible/modules/cloud/azure/azure_rm_virtualmachine_facts.py +++ b/lib/ansible/modules/cloud/azure/azure_rm_virtualmachine_facts.py @@ -347,10 +347,10 @@ class AzureRMVirtualMachineFacts(AzureRMModuleBase): disks = result['properties']['storageProfile']['dataDisks'] for disk_index in range(len(disks)): new_result['data_disks'].append({ - 'lun': disks[disk_index]['lun'], - 'disk_size_gb': disks[disk_index]['diskSizeGB'], - 'managed_disk_type': disks[disk_index]['managedDisk']['storageAccountType'], - 'caching': disks[disk_index]['caching'] + 'lun': disks[disk_index].get('lun'), + 'disk_size_gb': disks[disk_index].get('diskSizeGB'), + 'managed_disk_type': disks[disk_index].get('managedDisk', {}).get('storageAccountType'), + 'caching': disks[disk_index].get('caching') }) new_result['network_interface_names'] = []