Closed mamullen13316 closed 2 months ago
I have been encountering the exact same issue.
To add a little to this post, I get this added line to the end of the JSON response:
toml declined parsing InventoryFile.yml as it did not pass its verify_file() method
Only started to get this issue recently when v5.2.0 went live.
Hello @mamullen13316, thanks for the report. I have been unable to reproduce this using the demo site, can you confirm it is also broken with the following inventory file?
plugin: networktocode.nautobot.gql_inventory
api_endpoint: https://demo.nautobot.com
token: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
query:
devices:
filters:
manufacturer: "Cisco"
~As for your initial assessment regarding .get()
returning None, if "platform" is not a key in the device dict then device.get("platform", {})
should return what is after the comma (e.g. an empty dictionary) instead of None
. So, it sounds like device
in this case is instead None.~
Edit: I apologize, a correction to my previous statement as I understand the problem now. The key "platform" is indeed in the device dictionary but the value of platform is None. :iblameken:
Hi @joewesch, The demo environment works fine for me as well on 5.2.0. The demo environment also appears to have the platform field populated. Here's a device from the demo environment:
{'name': 'wee-n9k-02.nautobot.com', 'primary_ip4': {'host': '68.170.147.169'}, 'platform': {'napalm_driver': 'nxos'}}
Here's one from our environment:
{'name': 'use1-vpn-1a', 'primary_ip4': None, 'platform': None}
Haha, just noticed your :iblameken: :) Looks like we are on the same page now, let me know if you need any more info or testing.
ISSUE TYPE
SOFTWARE VERSIONS
pynautobot
pynautobot==2.1.1
Ansible:
ansible==9.5.1 ansible-core==2.16.6
Nautobot:
2.2.2
Collection:
networktocode.nautobot 5.2.0
SUMMARY
After upgrading from version 5.1.1 to 5.2.0, the below error
'NoneType' object has no attribute 'get'
is displayed when using the gql_inventory plugin. It appears to be trying to invoke a get after retrieving the platform on the device object here:We don't have anything populated in the platform field of our devices, so that initial query for
device.get("platform")
does return None. We'll need to add that soon anyway to start using the Golden Config Plugin.STEPS TO REPRODUCE
INVENTORY: inv.yml
PLAYBOOK: testinv.yml
ansible-playbook -i inv.yml testinv.yml -vvvv
EXPECTED RESULTS
Using 5.1.1...
ACTUAL RESULTS
Using 5.2.0...