mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-31 09:01:23 -07:00
fixed crash in facts (#50120)
This commit is contained in:
parent
f761cc4077
commit
756ad176cc
1 changed files with 3 additions and 1 deletions
|
@ -317,7 +317,9 @@ class AzureRMVirtualMachineFacts(AzureRMModuleBase):
|
||||||
new_result['state'] = 'present'
|
new_result['state'] = 'present'
|
||||||
new_result['location'] = vm.location
|
new_result['location'] = vm.location
|
||||||
new_result['vm_size'] = result['properties']['hardwareProfile']['vmSize']
|
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')
|
image = result['properties']['storageProfile'].get('imageReference')
|
||||||
if image is not None:
|
if image is not None:
|
||||||
if image.get('publisher', None) is not None:
|
if image.get('publisher', None) is not None:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue