Skip to content

Commit

Permalink
Fix for inventory host processing (ansible-collections#1545)
Browse files Browse the repository at this point in the history
This change provides sane defaults when NIC's are still in process of
coming up.
  • Loading branch information
p3ck authored and Justwmz committed Nov 4, 2024
1 parent cb32357 commit 3b0abc4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion plugins/inventory/azure_rm.py
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,8 @@ def hostvars(self):
# set nic-related values from the primary NIC first
for nic in sorted(self.nics, key=lambda n: n.is_primary, reverse=True):
# and from the primary IP config per NIC first
for ipc in sorted(nic._nic_model['properties']['ipConfigurations'], key=lambda i: i['properties'].get('primary', False), reverse=True):
for ipc in sorted(nic._nic_model.get('properties', {}).get('ipConfigurations', []),
key=lambda i: i.get('properties', {}).get('primary', False), reverse=True):
try:
subnet = ipc['properties'].get('subnet')
if subnet:
Expand Down

0 comments on commit 3b0abc4

Please sign in to comment.