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

Azure inventory traceback when NIC isn't fully provisioned #1544

Closed
p3ck opened this issue May 1, 2024 · 0 comments · Fixed by #1545
Closed

Azure inventory traceback when NIC isn't fully provisioned #1544

p3ck opened this issue May 1, 2024 · 0 comments · Fixed by #1545
Labels
bug Something isn't working has_pr PR fixes have been made medium_priority Medium priority

Comments

@p3ck
Copy link
Collaborator

p3ck commented May 1, 2024

SUMMARY

It's possible that a NIC hasn't fully come up for a VM when querying with the inventory plugin. If that happens you will get the following traceback when trying to access properties.

[WARNING]:  * Failed to parse /runner/inventory/azure_rm.yml with auto plugin:
'properties'
  File "/usr/lib/python3.9/site-packages/ansible/inventory/manager.py", line 293, in parse_source
    plugin.parse(self._inventory, self._loader, source, cache=cache)
  File "/usr/lib/python3.9/site-packages/ansible/plugins/inventory/auto.py", line 59, in parse
    plugin.parse(inventory, loader, path, cache=cache)
  File "/usr/share/ansible/collections/ansible_collections/azure/azcollection/plugins/inventory/azure_rm.py", line 233, in parse
    self._get_hosts()
  File "/usr/share/ansible/collections/ansible_collections/azure/azcollection/plugins/inventory/azure_rm.py", line 326, in _get_hosts
    if self._filter_exclude_host(inventory_hostname, h.hostvars):
  File "/usr/share/ansible/collections/ansible_collections/azure/azcollection/plugins/inventory/azure_rm.py", line 605, in hostvars
    for ipc in sorted(nic._nic_model['properties']['ipConfigurations'], key=lambda i: i['properties'].get('primary', False), reverse=True):
[WARNING]: Unable to parse /runner/inventory/azure_rm.yml as an inventory
source
ERROR! No inventory was parsed, please check your configuration and options.
ISSUE TYPE
  • Bug Report
COMPONENT NAME

inventory/azure_rm.py

ANSIBLE VERSION
ansible [core 2.15.9]
  config file = /root/.ansible/collections/ansible_collections/azure/azcollection/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /root/venv-3.9/lib64/python3.9/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /root/venv-3.9/bin/ansible
  python version = 3.9.18 (main, Sep 22 2023, 17:58:34) [GCC 8.5.0 20210514 (Red Hat 8.5.0-20)] (/root/venv-3.9/bin/python3.9)
  jinja version = 3.1.3
  libyaml = True
COLLECTION VERSION
# /root/venv-3.9/lib64/python3.9/site-packages/ansible_collections
Collection         Version
------------------ -------
azure.azcollection 2.3.0
CONFIGURATION
CONFIG_FILE() = /root/.ansible/collections/ansible_collections/azure/azcollection/ansible.cfg
DEFAULT_LOG_PATH(/root/.ansible/collections/ansible_collections/azure/azcollection/ansible.cfg) = /root/.ansible/colle>
OS / ENVIRONMENT

RHEL8.9

STEPS TO REPRODUCE

This is difficult to reproduce, It could be related to the number of VM's

@Fred-sun Fred-sun added bug Something isn't working has_pr PR fixes have been made medium_priority Medium priority labels May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working has_pr PR fixes have been made medium_priority Medium priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants