netdevopsbr / netbox-proxbox

Netbox Plugin for integration between Proxmox and Netbox
Apache License 2.0
338 stars 50 forks source link

netbox-proxbox and netbox 3.4.x #72

Closed wolfspyre closed 1 year ago

wolfspyre commented 1 year ago

Hi there!

First, Thank you for putting this together.

Have you tried netbox-proxbox with netbox3.4.x ?

with 3.3.x things seem to work as anticipated.

when attempting to enable the 0.0.5 version of the plugin in netbox3.4.x, netbox whines, moans, and ultimately fails:

netbox_1               | ImportError: cannot import name 'VirtualMachineStatusChoices' from 'virtualization.models' (/opt/netbox/netbox/virtualization/models/__init__.py)
netbox_1               | [ Use DB_WAIT_DEBUG=1 in netbox.env to print full traceback for errors here ]
netbox_1               | ImportError: cannot import name 'VirtualMachineStatusChoices' from 'virtualization.models' (/opt/netbox/netbox/virtualization/models/__init__.py)
netbox_1               | [ Use DB_WAIT_DEBUG=1 in netbox.env to print full traceback for errors here ]
netbox_1               | ImportError: cannot import name 'VirtualMachineStatusChoices' from 'virtualization.models' (/opt/netbox/netbox/virtualization/models/__init__.py)
netbox_1               | [ Use DB_WAIT_DEBUG=1 in netbox.env to print full traceback for errors here ]
netbox_1               | ImportError: cannot import name 'VirtualMachineStatusChoices' from 'virtualization.models' (/opt/netbox/netbox/virtualization/models/__init__.py)
netbox_1               | [ Use DB_WAIT_DEBUG=1 in netbox.env to print full traceback for errors here ]
netbox-docker_netbox_1 exited with code 143

This is running in Netbox-docker .. using netbox ver 3.4.1 and netbox-proxmox version="0.0.5-beta1"

Figured you'd want to know!

Chankster commented 1 year ago

In https://github.com/netdevopsbr/netbox-proxbox/blob/develop/netbox_proxbox/models.py#L15 change virtualization.models to virtualization.choices

wolfspyre commented 1 year ago

Yep!

I can confirm that does, in fact, fix the problem....

deniskonovalov64 commented 1 year ago

Good afternoon, I am installing this plugin on netbox 3.4.2 and faced with such an error:

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/opt/netbox-3.4.2/venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
    utility.execute()
  File "/opt/netbox-3.4.2/venv/lib/python3.8/site-packages/django/core/management/__init__.py", line 420, in execute
    django.setup()
  File "/opt/netbox-3.4.2/venv/lib/python3.8/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/opt/netbox-3.4.2/venv/lib/python3.8/site-packages/django/apps/registry.py", line 116, in populate
    app_config.import_models()
  File "/opt/netbox-3.4.2/venv/lib/python3.8/site-packages/django/apps/config.py", line 269, in import_models
    self.models_module = import_module(models_module_name)
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 848, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/opt/netbox-3.4.2/venv/lib/python3.8/site-packages/netbox_proxbox/models.py", line 15, in <module>
    from virtualization.models import VirtualMachineStatusChoices
ImportError: cannot import name 'VirtualMachineStatusChoices' from 'virtualization.models' (/opt/netbox-3.4.2/netbox/virtualization/models/__init__.py)

installed via pip3 What can be done in this case? Thank you in advance

deniskonovalov64 commented 1 year ago

Or I don't understand something

deniskonovalov64 commented 1 year ago

I understood where it was necessary to fix the config. Thanks)

Kris33 commented 1 year ago

What did you to to fix? I have the same problem ImportError: cannot import name 'VirtualMachineStatusChoices' from 'virtualization.models' (/opt/netbox-3.4.2/netbox/virtualization/models/init.py)

Chankster commented 1 year ago

@Kris33 as noted above:

In https://github.com/netdevopsbr/netbox-proxbox/blob/develop/netbox_proxbox/models.py#L15 change virtualization.models to virtualization.choices

Kris33 commented 1 year ago

Done. Yet, I still have the error.

Chankster commented 1 year ago

Can you post your full traceback?

Kris33 commented 1 year ago

FInally had it working after upgrading to netbox 3.4.3.

Yet I still have this nagging erro after clicking on Full update:

Server Error

There was a problem with your request. Please contact an administrator.

The complete exception is provided below:

<class 'AttributeError'>

object has no attribute "slug"

Python version: 3.9.13 NetBox version: 3.4.3

Can't seems to be able to get rid of it.

Proxmox version is 7.3-4

Chankster commented 1 year ago

Will still need a full traceback.

Kris33 commented 1 year ago

how do I generate that ? I have no more error

JouanDeag commented 1 year ago

See issue #59 This has already been reported