Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for inventory host processing #1545

Merged
merged 1 commit into from
May 13, 2024

Conversation

p3ck
Copy link
Collaborator

@p3ck p3ck commented May 1, 2024

SUMMARY

This change provides sane defaults when NIC's are still in process of coming up.

Fixes #1544

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

plugins/inventory/azure_rm.py

ADDITIONAL INFORMATION

See the issue for the traceback that this fixes

I've had the customer that experienced this traceback use this patch and it fixes the issue.

Copy link
Collaborator

@Fred-sun Fred-sun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small change request!

plugins/inventory/azure_rm.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@Fred-sun Fred-sun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, not enough indent!

@@ -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', []),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@p3ck continuation line under-indented

        for ipc in sorted(nic._nic_model.get('properties', {}).get('ipConfigurations', []),
                          key=lambda i: i.get('properties', {}).get('primary', False), reverse=True)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed - Thank for the review

This change provides sane defaults when NIC's are still in process of
coming up.
@Fred-sun Fred-sun added ready_for_review The PR has been modified and can be reviewed and merged medium_priority Medium priority labels May 6, 2024
@Fred-sun
Copy link
Collaborator

Fred-sun commented May 6, 2024

ready_for_review!

@xuzhang3 xuzhang3 merged commit 6dbadce into ansible-collections:dev May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
medium_priority Medium priority ready_for_review The PR has been modified and can be reviewed and merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Azure inventory traceback when NIC isn't fully provisioned
3 participants