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

[Bug]: Schema caching is broken #1052

Closed
decoupca opened this issue Aug 16, 2023 · 0 comments
Closed

[Bug]: Schema caching is broken #1052

decoupca opened this issue Aug 16, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@decoupca
Copy link
Contributor

Ansible NetBox Collection version

v3.13.0

Ansible version

ansible [core 2.15.1]
  config file = /Users/decoupca/code/ansible/ansible-dev.cfg
  configured module search path = ['/Users/decoupca/code/ansible/library']
  ansible python module location = /Users/decoupca/code/ansible/venv/lib/python3.11/site-packages/ansible
  ansible collection location = /Users/decoupca/.ansible/collections:/usr/share/ansible/collections
  executable location = /Users/decoupca/code/ansible/venv/bin/ansible
  python version = 3.11.4 (main, Jun 20 2023, 17:23:00) [Clang 14.0.3 (clang-1403.0.22.14.1)] (/Users/decoupca/code/ansible/venv/bin/python3.11)
  jinja version = 3.1.2
  libyaml = True

NetBox version

v3.5.6

Python version

3.11

Steps to Reproduce

Use nb_inventory plugin to run a playbook more than once. The play doesn't matter, only that nb_inventory is used as an inventory source.

Expected Behavior

On the first run, nb_inventory fetches the API schema at api/schema/?format=json and caches it to ~/.ansible/tmp/netbox_api_dump.json. Future runs using the same version of NetBox should use this cached copy. This is important for performance because the schema file is in many cases very large (>6MB in my testing), so retrieving it every run degrades performance significantly.

Observed Behavior

nb_inventory fetches the API schema on every run, regardless of the fact that A) the version of NetBox hasn't changed, and B) there is a cached copy in ~/.ansible/tmp.

@decoupca decoupca added the bug Something isn't working label Aug 16, 2023
decoupca added a commit to decoupca/ansible_modules that referenced this issue Aug 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant