kkthxbye-code / netbox-old-search

Adds the old search functionality to NetBox 3.3+
Apache License 2.0
6 stars 0 forks source link

Work with 4.x? #3

Closed cbragwel closed 1 month ago

cbragwel commented 1 month ago

We are running your plugin in 3.7.8 and really enjoy the old search. We are testing upgrading to 4.1.1, but we get a "Service Error 503" when the plugin is configured in the configuration.py file. When it is removed, the service starts up properly. Will your plugin be updated to work with 4.x?

kkthxbye-code commented 1 month ago

Sure, I'll fix it this weekend.

kkthxbye-code commented 1 month ago

@cbragwel - I pushed a new version, please try it out. I tested on 4.0.11 and 4.1.1, though only superficially. Not sure if there's been any major additions of objects that should be included in the search.

cbragwel commented 1 month ago

Thank you very much. I tried it this morning, but still getting Service Error 503. I did uninstall the old plugin and installed the new plugin and restarted services. I'm running the 1.0.0 plugin. When I look at the netbox.service status, here's what I see when the plugin is in the configuration.py file and when it is removed.

With plugin noc@LAB-Netbox:/var/log/netbox$ systemctl status netbox.service ● netbox.service - NetBox WSGI Service Loaded: loaded (/etc/systemd/system/netbox.service; enabled; vendor preset: enabled) Active: activating (auto-restart) (Result: exit-code) since Fri 2024-09-20 12:46:16 UTC; 2s ago Docs: https://docs.netbox.dev/ Process: 1415 ExecStart=/opt/netbox/venv/bin/gunicorn --pid /var/tmp/netbox.pid --pythonpath /opt/netbox/netbox --config /opt/netbox/gunicorn.py netbox.wsgi (code=exited, status=1/FAILURE) Main PID: 1415 (code=exited, status=1/FAILURE) CPU: 2.004s

Without plugin noc@LAB-Netbox:/opt/netbox/netbox/netbox$ systemctl status netbox.service ● netbox.service - NetBox WSGI Service Loaded: loaded (/etc/systemd/system/netbox.service; enabled; vendor preset: enabled) Active: active (running) since Fri 2024-09-20 12:49:37 UTC; 9s ago Docs: https://docs.netbox.dev/ Main PID: 1533 (gunicorn) Tasks: 6 (limit: 4557) Memory: 540.1M CPU: 6.305s CGroup: /system.slice/netbox.service ├─1533 /opt/netbox-4.1.1/venv/bin/python3 /opt/netbox/venv/bin/gunicorn --pid /var/tmp/netbox.pid --pythonpath /opt/netbox/netbox --config /opt/netbox/gunicorn.py netbox.wsgi ├─1534 /opt/netbox-4.1.1/venv/bin/python3 /opt/netbox/venv/bin/gunicorn --pid /var/tmp/netbox.pid --pythonpath /opt/netbox/netbox --config /opt/netbox/gunicorn.py netbox.wsgi ├─1535 /opt/netbox-4.1.1/venv/bin/python3 /opt/netbox/venv/bin/gunicorn --pid /var/tmp/netbox.pid --pythonpath /opt/netbox/netbox --config /opt/netbox/gunicorn.py netbox.wsgi ├─1536 /opt/netbox-4.1.1/venv/bin/python3 /opt/netbox/venv/bin/gunicorn --pid /var/tmp/netbox.pid --pythonpath /opt/netbox/netbox --config /opt/netbox/gunicorn.py netbox.wsgi ├─1537 /opt/netbox-4.1.1/venv/bin/python3 /opt/netbox/venv/bin/gunicorn --pid /var/tmp/netbox.pid --pythonpath /opt/netbox/netbox --config /opt/netbox/gunicorn.py netbox.wsgi └─1538 /opt/netbox-4.1.1/venv/bin/python3 /opt/netbox/venv/bin/gunicorn --pid /var/tmp/netbox.pid --pythonpath /opt/netbox/netbox --config /opt/netbox/gunicorn.py netbox.wsgi

Sep 20 12:49:37 LAB-Netbox systemd[1]: Started NetBox WSGI Service. Sep 20 12:49:37 LAB-Netbox gunicorn[1533]: [2024-09-20 12:49:37 +0000] [1533] [INFO] Starting gunicorn 23.0.0 Sep 20 12:49:37 LAB-Netbox gunicorn[1533]: [2024-09-20 12:49:37 +0000] [1533] [INFO] Listening at: http://127.0.0.1:8001 (1533) Sep 20 12:49:37 LAB-Netbox gunicorn[1533]: [2024-09-20 12:49:37 +0000] [1533] [INFO] Using worker: gthread Sep 20 12:49:37 LAB-Netbox gunicorn[1534]: [2024-09-20 12:49:37 +0000] [1534] [INFO] Booting worker with pid: 1534 Sep 20 12:49:37 LAB-Netbox gunicorn[1535]: [2024-09-20 12:49:37 +0000] [1535] [INFO] Booting worker with pid: 1535 Sep 20 12:49:37 LAB-Netbox gunicorn[1536]: [2024-09-20 12:49:37 +0000] [1536] [INFO] Booting worker with pid: 1536 Sep 20 12:49:37 LAB-Netbox gunicorn[1537]: [2024-09-20 12:49:37 +0000] [1537] [INFO] Booting worker with pid: 1537 Sep 20 12:49:37 LAB-Netbox gunicorn[1538]: [2024-09-20 12:49:37 +0000] [1538] [INFO] Booting worker with pid: 1538

cbragwel commented 1 month ago

This is in my syslog:

Sep 20 13:09:54 LAB-Netbox gunicorn[2546]: django.core.exceptions.ImproperlyConfigured: Unable to import plugin netbox_old_search: Module not found. Check that the plugin module has been installed within the correct Python environment. Sep 20 13:09:54 LAB-Netbox gunicorn[2546]: [2024-09-20 13:09:54 +0000] [2546] [INFO] Worker exiting (pid: 2546) Sep 20 13:09:54 LAB-Netbox systemd[1]: netbox.service: Main process exited, code=exited, status=1/FAILURE Sep 20 13:09:54 LAB-Netbox systemd[1]: netbox.service: Failed with result 'exit-code'. Sep 20 13:09:54 LAB-Netbox systemd[1]: netbox.service: Consumed 1.967s CPU time.

kkthxbye-code commented 1 month ago

@cbragwel - Make sure you activate the virtual environment before you install the plugin.

/opt/netbox/venv/ seems to be your venv, so something like source /opt/netbox/venv/bin/activate.

Alternatively, add netbox-old-search to local_requirements.txt and then run ./upgrade.sh.

cbragwel commented 1 month ago

Thank you so much. I wasn't in the virtual environment. Your plugin is working great.

kkthxbye-code commented 1 month ago

No problem, glad to help!