ArnesSI / netbox-inventory

Manage your hardware inventory in NetBox
MIT License
213 stars 21 forks source link

Application labels aren't unique, duplicates: netbox_inventory #194

Closed Zheer09 closed 1 month ago

Zheer09 commented 2 months ago

Using docker to install the plugin i am getting duplicate label issue error while adding a plugin in my /configuration/plugins.py file and no i didn't add any plugins into configuration/configuration.py

Error

2.289 🧬 loaded config '/etc/netbox/config/configuration.py'                                                                                                                                                                        
2.289 🧬 loaded config '/etc/netbox/config/extra.py'                                                                                                                                                                                
2.289 🧬 loaded config '/etc/netbox/config/logging.py'                                                                                                                                                                              
2.289 🧬 loaded config '/etc/netbox/config/plugins.py'                                                                                                                                                                              
2.290 Traceback (most recent call last):
2.290   File "/opt/netbox/netbox/manage.py", line 10, in <module>
2.290     execute_from_command_line(sys.argv)
2.290   File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
2.290     utility.execute()
2.290   File "/opt/netbox/venv/lib/python3.12/site-packages/django/core/management/__init__.py", line 416, in execute
2.290     django.setup()
2.290   File "/opt/netbox/venv/lib/python3.12/site-packages/django/__init__.py", line 24, in setup
2.290     apps.populate(settings.INSTALLED_APPS)
2.290   File "/opt/netbox/venv/lib/python3.12/site-packages/django/apps/registry.py", line 93, in populate
2.290     raise ImproperlyConfigured(
2.290 django.core.exceptions.ImproperlyConfigured: Application labels aren't unique, duplicates: netbox_inventory

Dockerfile:

FROM netboxcommunity/netbox:4.1.0

COPY ./plugin_requirements.txt /opt/netbox/
RUN /opt/netbox/venv/bin/pip install  --no-warn-script-location -r /opt/netbox/plugin_requirements.txt

# These lines are only required if your plugin has its own static files.
COPY configuration/configuration.py /etc/netbox/config/configuration.py
COPY configuration/plugins.py /etc/netbox/config/plugins.py
RUN SECRET_KEY="dummydummydummydummydummydummydummydummydummydummy" /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py collectstatic --no-input

Plugins python file

PLUGINS = ["netbox_inventory",'netbox_dns','netbox_reorder_rack','netbox_topology_views','netbox_branching','netbox_contract','netbox_slm'  ]

PLUGINS_CONFIG = {
    "netbox_inventory": {}
}

netbox version: v4.1.0 Docker version: 27.2.1

NetTech2001 commented 1 month ago

I see the same error when I am running netbox_inventory alongside the netbox_bgp plugin. I am not running the following plugins that you are though so if you arent running BGP then it could be one of these 'netbox_topology_views','netbox_branching','netbox_contract','netbox_slm'

matejv commented 1 month ago

I can't reproduce this. I've tried building netbox fresh docker images using most plugins you seem to be using:

plugin_requirements.txt

netbox-inventory
netbox-plugin-dns
netbox-reorder-rack
netbox-topology-views
netbox-contract
netbox-slm

configuration/plugins.py

PLUGINS = ['netbox_inventory','netbox_dns','netbox_reorder_rack','netbox_topology_views','netbox_contract','netbox_slm',]

PLUGINS_CONFIG = {
    "netbox_inventory": {}
}

This works fine. When I try to add netbox_branching I get different errors, that are not related to netbox-inventory plugin. This is because netbox_branching requires additional special configuration I don't know how to add to netbox-docker.

Anyway, try it without netbox_branching and with latest netbox version.

matejv commented 1 month ago

I've also tested a local venv install of netbox (no docker) with the same set of plugins including netbox_branching and it seems to work fine as well.

Zheer09 commented 1 month ago

I just tried it today i have updated a lot of configuration and update since last 3 weeks, and it is working now.

Appreciated your reply on this issue, it is resolved.