1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Added checks for machine.os_profile is not None before trying to access child attributes (#22906)

This commit is contained in:
James Portman 2017-08-15 18:59:41 +01:00 committed by Matt Davis
parent 064ab7a92d
commit 950e4b6505

View file

@ -538,7 +538,7 @@ class AzureInventory(object):
mac_address=None, mac_address=None,
plan=(machine.plan.name if machine.plan else None), plan=(machine.plan.name if machine.plan else None),
virtual_machine_size=machine.hardware_profile.vm_size, virtual_machine_size=machine.hardware_profile.vm_size,
computer_name=machine.os_profile.computer_name, computer_name=(machine.os_profile.computer_name if machine.os_profile else None),
provisioning_state=machine.provisioning_state, provisioning_state=machine.provisioning_state,
) )
@ -559,7 +559,7 @@ class AzureInventory(object):
) )
# Add windows details # Add windows details
if machine.os_profile.windows_configuration is not None: if machine.os_profile is not None and machine.os_profile.windows_configuration is not None:
host_vars['windows_auto_updates_enabled'] = \ host_vars['windows_auto_updates_enabled'] = \
machine.os_profile.windows_configuration.enable_automatic_updates machine.os_profile.windows_configuration.enable_automatic_updates
host_vars['windows_timezone'] = machine.os_profile.windows_configuration.time_zone host_vars['windows_timezone'] = machine.os_profile.windows_configuration.time_zone