Backport/2.7/50120 (#52444)

* fixed crash in facts (#50120)

(cherry picked from commit 756ad176cc)

* added changelog
pull/52466/head^2
Zim Kalinowski 7 years ago committed by Toshio Kuratomi
parent bbf2d6b637
commit e531356d07

@ -0,0 +1,2 @@
bugfixes:
- azure_rm_virtualmachine_facts - fixed crash related to VM with managed disk attached

@ -294,7 +294,9 @@ class AzureRMVirtualMachineFacts(AzureRMModuleBase):
new_result['state'] = 'present'
new_result['location'] = vm.location
new_result['vm_size'] = result['properties']['hardwareProfile']['vmSize']
new_result['admin_username'] = result['properties']['osProfile']['adminUsername']
os_profile = result['properties'].get('osProfile')
if os_profile is not None:
new_result['admin_username'] = os_profile.get('adminUsername')
image = result['properties']['storageProfile'].get('imageReference')
if image is not None:
new_result['image'] = {

Loading…
Cancel
Save