netbox-community / ansible_modules

NetBox modules for Ansible using Ansible Collections
GNU General Public License v3.0
330 stars 211 forks source link

[Bug]: Inventory plugin call /api/status and produce Page Not Found Django warning #1335

Open ihumster opened 5 days ago

ihumster commented 5 days ago

Ansible NetBox Collection version

v3.20.0

Ansible version

ansible [core 2.16.3]
  config file = None
  configured module search path = ['/Users/aenikitin/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/aenikitin/.pyenv/versions/3.12.2/lib/python3.12/site-packages/ansible
  ansible collection location = /Users/aenikitin/.ansible/collections:/usr/share/ansible/collections
  executable location = /Users/aenikitin/.pyenv/versions/3.12.2/bin/ansible
  python version = 3.12.2 (main, Feb 18 2024, 17:46:45) [Clang 15.0.0 (clang-1500.1.0.2.5)] (/Users/aenikitin/.pyenv/versions/3.12.2/bin/python3.12)
  jinja version = 3.1.4
  libyaml = True

NetBox version

v.3.6.9

Python version

3.10

Steps to Reproduce

Connect your netbox instance to sentry and just use nb_inventory plugin.

Expected Behavior

Sentry can't get Page Not Found warning for /api/status url.

Observed Behavior

Sentry get Page Not Found warning for /api/status url.

dannywade commented 4 days ago

@ihumster Thank you for raising this issue and providing a fix! I've been trying to use the nb_inventory plugin to sync my NetBox inventory and keep receiving the following error message: Invalid host pattern 'plugin:' supplied, ending in ':' is not allowed, this. After some research, it seemed like the issue was with my inventory file (wrong key/value) or authenticating to my NetBox instance, but I was able to confirm neither were a problem. I'm very glad I came across this issue - it saved me from more headaches. Hopefully this gets merged soon!

sc68cal commented 4 days ago

Hi, what is Sentry? My concern around this is that we have a lot of users that put proxies in front of NetBox that cause all kinds of problems, and I'd like to know more about your setup before accepting your PR that fixes this issue.

sc68cal commented 4 days ago

Nevermind I took a look at https://github.com/netbox-community/netbox/blame/develop/netbox/netbox/urls.py#L56

ihumster commented 4 days ago

@sc68cal https://sentry.io/

sc68cal commented 4 days ago

Ok, I understand now, it was emitting a warning in the logs of the server running NetBox and Sentry was warning you about it?

ihumster commented 3 days ago

Yes. Every run ansible-playbook or ansible-inventory generate Page Not Found issue in Sentry. image