netbox-proxbox icon indicating copy to clipboard operation
netbox-proxbox copied to clipboard

Support for netbox 4.x

Open dBitech opened this issue 1 year ago • 135 comments

There were changes in netbox 3.7 which were further deprecated in 4.0 Please see Migrating Your Plugin to NetBox v4.0 for porting instructions to make the plugin compatible with 4.x

dBitech avatar May 11 '24 11:05 dBitech

Yep it's broken at the moment. ModuleNotFoundError: No module named 'extras.plugins'

xXAzazelXx avatar Jul 21 '24 05:07 xXAzazelXx

Can I do something to fix it, or must I wait until a new Version of Proxbox is coming out?

OberMarcLP avatar Aug 22 '24 21:08 OberMarcLP

I also encountered the error today, i wanted to install this plugin on a new installation but got the following errors:

`1.171 Traceback (most recent call last):
1.171 File "/opt/netbox/venv/lib/python3.11/site-packages/django/core/management/init.py", line 255, in fetch_command 1.171 🧬 loaded config '/etc/netbox/config/configuration.py' 1.171 🧬 loaded config '/etc/netbox/config/extra.py' 1.171 🧬 loaded config '/etc/netbox/config/logging.py' 1.171 🧬 loaded config '/etc/netbox/config/plugins.py' 1.171 app_name = commands[subcommand] 1.171 ~~~~~~~~^^^^^^^^^^^^ 1.171 KeyError: 'collectstatic' 1.171 1.171 During handling of the above exception, another exception occurred: 1.171 1.171 Traceback (most recent call last): 1.171 File "/opt/netbox/netbox/manage.py", line 10, in 1.172 execute_from_command_line(sys.argv) 1.172 File "/opt/netbox/venv/lib/python3.11/site-packages/django/core/management/init.py", line 442, in execute_from_command_line 1.172 utility.execute() 1.172 File "/opt/netbox/venv/lib/python3.11/site-packages/django/core/management/init.py", line 436, in execute 1.172 self.fetch_command(subcommand).run_from_argv(self.argv) 1.172 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1.172 File "/opt/netbox/venv/lib/python3.11/site-packages/django/core/management/init.py", line 262, in fetch_command 1.172 settings.INSTALLED_APPS 1.172 File "/opt/netbox/venv/lib/python3.11/site-packages/django/conf/init.py", line 89, in getattr 1.172 self._setup(name) 1.172 File "/opt/netbox/venv/lib/python3.11/site-packages/django/conf/init.py", line 76, in _setup 1.172 self._wrapped = Settings(settings_module) 1.172 ^^^^^^^^^^^^^^^^^^^^^^^^^ 1.172 File "/opt/netbox/venv/lib/python3.11/site-packages/django/conf/init.py", line 190, in init 1.172 mod = importlib.import_module(self.SETTINGS_MODULE) 1.172 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1.172 File "/usr/lib/python3.11/importlib/init.py", line 126, in import_module 1.172 return _bootstrap._gcd_import(name[level:], package, level) 1.172 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1.172 File "", line 1204, in _gcd_import 1.172 File "", line 1176, in _find_and_load 1.172 File "", line 1147, in _find_and_load_unlocked 1.172 File "", line 690, in _load_unlocked 1.172 File "", line 940, in exec_module 1.173 File "", line 241, in _call_with_frames_removed 1.173 File "/opt/netbox/netbox/netbox/settings.py", line 785, in 1.173 raise e 1.173 File "/opt/netbox/netbox/netbox/settings.py", line 778, in 1.173 plugin = importlib.import_module(plugin_name) 1.173 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1.173 File "/usr/lib/python3.11/importlib/init.py", line 126, in import_module 1.173 return _bootstrap._gcd_import(name[level:], package, level) 1.173 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1.173 File "", line 1204, in _gcd_import 1.173 File "", line 1176, in _find_and_load 1.173 File "", line 1147, in _find_and_load_unlocked 1.173 File "", line 690, in _load_unlocked 1.173 File "", line 940, in exec_module 1.173 File "", line 241, in _call_with_frames_removed 1.173 File "/opt/netbox/venv/lib/python3.11/site-packages/netbox_proxbox/init.py", line 2, in 1.173 from extras.plugins import PluginConfig 1.173 ModuleNotFoundError: No module named 'extras.plugins'

`

Seems that the issue still fails on ModuleNotFoundError: No module named 'extras.plugins', can someone check this out?

I am running on Netbox v4.0.9

Tehniels2000 avatar Aug 23 '24 08:08 Tehniels2000

Why do you not make a new release for 4.x? I already see commit. https://github.com/netdevopsbr/netbox-proxbox/commit/de2bb66c78be3cf8d20c93afd2f0e3c5ed6b3d9c
Since I use docker I do not know how to use non released changes.

Uzoma8Chi avatar Sep 06 '24 12:09 Uzoma8Chi

Why do you not make a new release for 4.x? I already see commit. [de2bb66c78be3cf8d20c93afd2f0e3c5ed6b3d9c](https://github.com/netdevopsbr/netbox-proxbox/commit/de2bb66c78be3cf8d20c93afd2f0e3c5ed6b3d9c) Since I use docker I do not know how to use non released changes.

The github version installs on 4.x, but it still doesn't seem to work on the latest netbox release

fibretel avatar Sep 15 '24 08:09 fibretel

I'm having the same problem with Netbox 4.1.1. When trying to run python3 manage.py migrate I get the same errors as @Tehniels2000.

Any ETA for a fix for this problem?

psiess avatar Sep 19 '24 15:09 psiess

Currently working on support for latest Netbox version.

emersonfelipesp avatar Sep 25 '24 13:09 emersonfelipesp

Currently working on support for latest Netbox version.

Excellent. Thank you for the letting us know.

psiess avatar Sep 25 '24 14:09 psiess

Hello, sorry to push this, but is there any ETA?

maxdallmair avatar Oct 10 '24 20:10 maxdallmair

Currently working on it, on my test env everything is going fine. You guys can already test it. But I'm improving testing and corner cases, as it's not easy to predict all Proxmox environments.

emersonfelipesp avatar Oct 11 '24 15:10 emersonfelipesp

I would like to also note that although I love the project and its function, I do it as best-effort and have no return. I'm really glad the amount of people that use it, but I ask for some patience, if possible.

emersonfelipesp avatar Oct 11 '24 15:10 emersonfelipesp

Thank you for all your work on this, Emerson.

How can I get access to test the update that supports 4.x?


From: Emerson Felipe @.> Sent: October 11, 2024 11:30 AM To: netdevopsbr/netbox-proxbox @.> Cc: Paul Siess @.>; Comment @.> Subject: Re: [netdevopsbr/netbox-proxbox] Support for netbox 4.x (Issue #176)

Currently working on it, on my test env everything is going fine. You guys can already test it. But I'm improving testing and corner cases, as it's not easy to predict all Proxmox environments.

— Reply to this email directly, view it on GitHubhttps://github.com/netdevopsbr/netbox-proxbox/issues/176#issuecomment-2407654801, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABWEE446ILQX5JVR2S2RDRDZ27VINAVCNFSM6AAAAABHR3Q4KOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMBXGY2TIOBQGE. You are receiving this because you commented.Message ID: @.***>

psiess avatar Oct 17 '24 15:10 psiess

Hello, I tried to install the current develop branch version but I get the following error:

The complete exception is provided below:

<class 'KeyError'>

'fastapi'

Python version: 3.11.2
NetBox version: 4.1.4
Plugins: 
  netbox_proxbox: 0.0.5

But based on pip list fastapi is installed fastapi 0.115.2.

Do you have any Ideas what I'm doing wrong?

spacecodeit avatar Oct 18 '24 09:10 spacecodeit

Hi @spacecodeit could you please the last commits and confirm that fastapi is installed on Netbox Virtual Venv (/opt/netbox/venv)?

Also, now on Proxbox plugin homepage, there is connection status to the services and log messages on the bottom, as you click on Proxmox Full Update button. Send me the output log messages, if possible.

emersonfelipesp avatar Oct 18 '24 15:10 emersonfelipesp

Hi @psiess, you just need to pull the develop (using git checkout develop) branch and you're fine. I'm currently working on it, but plugin should work.

emersonfelipesp avatar Oct 18 '24 15:10 emersonfelipesp

Hi @psiess, you just need to pull the develop (using git checkout develop) branch and you're fine. I'm currently working on it, but plugin should work.

Sorry for the newbie question. How do I pull the develop branch? I cloned the repository and can see the branches

git branch -a

  • develop remotes/origin/HEAD -> origin/develop remotes/origin/auto-update remotes/origin/backend remotes/origin/develop remotes/origin/gh-pages remotes/origin/main remotes/origin/optimize-performance remotes/origin/proxmox-folder-view

...but I can't figure out how to pull the develop branch. I tried git clone develop and git pull develop but neither work.

psiess avatar Oct 18 '24 18:10 psiess

I think you already switched to develop. If not, just issue the git checkout develop command and then git branch to check if it worked.

emersonfelipesp avatar Oct 18 '24 18:10 emersonfelipesp

You are right @emersonfelipesp. I was able to install netbox-proxbox, but get an error right at the end of the installation:

Installed /opt/netbox/venv/lib/python3.12/site-packages/fastapi_cli-0.0.5-py3.12.egg error: starlette 0.41.0 is installed but starlette<0.41.0,>=0.37.2 is required by {'fastapi'}

Can I downgrade starlette without messing up the rest of netbox? Or install a lower version alongside the 0.41.0?

psiess avatar Oct 18 '24 18:10 psiess

I'm currently using starlette=0.38.6

Yo can try this version with: pip install -Iv starlette=0.38.6

emersonfelipesp avatar Oct 18 '24 18:10 emersonfelipesp

@psiess try using the git pull again to get my last commits. I have added/changed:

Let me now if it works!

emersonfelipesp avatar Oct 18 '24 19:10 emersonfelipesp

I actually had to use starlette==0.40.0 as Github pointed out the previous version had a major security issue. Just tested 0.40.0 version and apparently looks good.

emersonfelipesp avatar Oct 18 '24 19:10 emersonfelipesp

Do I need to re-install after the new pull?

psiess avatar Oct 18 '24 19:10 psiess

@psiess I'm not sure, but would be good.

emersonfelipesp avatar Oct 18 '24 20:10 emersonfelipesp

I also want to be sure I'm doing this right. I currently go into /opt/netbox/netbox/netbox-proxbox and do a git pull to get the latest. Then, in /opt/netbox I execute ./update.sh with netbox-proxbox in the local_requirements file.

I'm not sure it's working because Netbox doesn't start with the plugin activated. If I remove netbox_proxbox from the configuration.py file that Netbox will start.

Is there a different way I should be doing that?

troycarpenter avatar Oct 18 '24 23:10 troycarpenter

Hi @troycarpenter, could you se Netbox logs? I don't get why it didn't work. I'm putting a lot of effort on Docs and Proxbox Plugin GUI so that User knows exactly what is going on. But for now, I'll need some help from you guys to find the bugs.

emersonfelipesp avatar Oct 19 '24 12:10 emersonfelipesp

I have tried all the ways I've found online to get Netbox to log to a file, but nothing has worked for me. It's gone as far as creating the log file, but nothing is ever logged there. In configuration.py, I have this:

DEBUG = True
import logging.handlers
LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'formatters': {
        'normal': {
            'format': '%(asctime)s %(name)s %(levelname)s: %(message)s'
        },
    },
    'handlers': {
        'file': {
            'level': 'DEBUG',
            'class': 'logging.handlers.WatchedFileHandler',
            'filename': '/var/log/netbox/netbox.log',
            'formatter': 'normal',
        },
        'console': {
            'class': 'logging.StreamHandler',
        },
    },
    'root': {
        'handlers': ['console'],
        'level': 'INFO',
    },
    'loggers': {
        'django': {
            'handlers': ['file'],
            'level': 'INFO',
        },
        'netbox': {
            'handlers': ['file'],
            'level': 'INFO',
        },
    },
}

That logging section is now a frankenstien based on a few websites.

troycarpenter avatar Oct 19 '24 13:10 troycarpenter

Could you please send me your plugins configuration? With PLUGINS and PLUGINS_CONFIG variables.

emersonfelipesp avatar Oct 19 '24 16:10 emersonfelipesp

PLUGINS = [
            'netbox_proxbox',
            'netbox_ipcalculator',
            'netbox_routing',
]
PLUGINS_CONFIG = {
    'netbox_proxbox': {
        'proxmox':
            {
                'domain': 'pve.xxxx.xx',    # May also be IP address
                'http_port': 8006,
                'user': 'root@pam',   # always required
                'password': 'redacted', # only required, if you don't want to use token based authentication
                'ssl': True,
                'token': {
                    'name': 'proxbox',  # Only type the token name and not the 'user@pam:tokenID' format
                    'value': 'proxboxtokenredacted'
                },
            },
        'netbox': {
            'domain': 'localhost',     # Ensure localhost is added to ALLOWED_HOSTS
            'http_port': 8001,     # Gunicorn port.
            'token': 'netboxtokenredacted',
            'ssl': False, # There is no support to SSL on Netbox yet, so let it always False.
            'settings': {
                'virtualmachine_role_id' : 0,
                'node_role_id' : 0,
                'site_id': 0
            }
        }
    }
}

The first time I used Proxbox, it was on a version 3.x and at that time I was able to pull in my VM information initially, so I do already have database entries for Proxbox (if that makes sense).

troycarpenter avatar Oct 20 '24 20:10 troycarpenter

Hi @troycarpenter! You just need to insert the code below netbox:

'fastapi': {
    # Uvicorn Host is (most of the time) the same as Netbox (as both servers run on the same machine)
    'uvicorn_host': 'localhost',
    'uvicorn_port': 8800    # Default Proxbox FastAPI port
}

Follow the Documentantion Example if in doubt

After configuring FastAPI on configuration.py, follow systemd Setup instructions and then Proxbox will work.

At the time you used Proxbox, I wasn't using FastAPI as the backend service. So just add this step and let me know if it works!

emersonfelipesp avatar Oct 21 '24 12:10 emersonfelipesp

OBS: Any solution I'm providing here will work only with GitHub repository and not PyPI package, as I didn't launched the official version yet. So pip3 install netbox-proxbox won't ever work on Netbox v4.0

emersonfelipesp avatar Oct 21 '24 12:10 emersonfelipesp