Backport/2.7/49704 (#52467)
* backport image crash fix * adding changelog fragment
This commit is contained in:
parent
2800f23274
commit
f85cd0b0c2
2 changed files with 13 additions and 6 deletions
2
changelogs/fragments/49704-fix-vm-facts-crash.yaml
Normal file
2
changelogs/fragments/49704-fix-vm-facts-crash.yaml
Normal file
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- azure_rm_virtualmachine_facts - fix crash when vm created from custom image
|
|
@ -299,12 +299,17 @@ class AzureRMVirtualMachineFacts(AzureRMModuleBase):
|
|||
new_result['admin_username'] = os_profile.get('adminUsername')
|
||||
image = result['properties']['storageProfile'].get('imageReference')
|
||||
if image is not None:
|
||||
new_result['image'] = {
|
||||
'publisher': image['publisher'],
|
||||
'sku': image['sku'],
|
||||
'offer': image['offer'],
|
||||
'version': image['version']
|
||||
}
|
||||
if image.get('publisher', None) is not None:
|
||||
new_result['image'] = {
|
||||
'publisher': image['publisher'],
|
||||
'sku': image['sku'],
|
||||
'offer': image['offer'],
|
||||
'version': image['version']
|
||||
}
|
||||
else:
|
||||
new_result['image'] = {
|
||||
'id': image.get('id', None)
|
||||
}
|
||||
|
||||
vhd = result['properties']['storageProfile']['osDisk'].get('vhd')
|
||||
if vhd is not None:
|
||||
|
|
Loading…
Reference in a new issue