Skip to content

Commit

Permalink
Fix for inventory host processing (#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 May 13, 2024
1 parent e3624b4 commit 6dbadce
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 @@ -602,7 +602,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 6dbadce

Please sign in to comment.