netdevopsbr / netbox-proxbox

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

'str' object has no attribute 'id' #74

Closed syswipe closed 1 year ago

syswipe commented 1 year ago

Proxmox Full Update gives me the next error:

<class 'AttributeError'>

'str' object has no attribute 'id'

Python version: 3.9.2
NetBox version: 3.4.1

in Proxmox log I saw the next:

Jan 24 09:07:56 nb1 gunicorn[51095]: Internal Server Error: /plugins/proxbox/full_update/ Jan 24 09:07:56 nb1 gunicorn[51095]: Traceback (most recent call last): Jan 24 09:07:56 nb1 gunicorn[51095]: File "/opt/netbox-3.4.1/venv/lib/python3.9/site-packages/django/core/handlers/exception.py", line 55, in inner Jan 24 09:07:56 nb1 gunicorn[51095]: response = get_response(request) Jan 24 09:07:56 nb1 gunicorn[51095]: File "/opt/netbox-3.4.1/venv/lib/python3.9/site-packages/django/core/handlers/base.py", line 197, in _get_response Jan 24 09:07:56 nb1 gunicorn[51095]: response = wrapped_callback(request, *callback_args, callback_kwargs) Jan 24 09:07:56 nb1 gunicorn[51095]: File "/opt/netbox-3.4.1/venv/lib/python3.9/site-packages/django/views/generic/base.py", line 103, in view Jan 24 09:07:56 nb1 gunicorn[51095]: return self.dispatch(request, *args, *kwargs) Jan 24 09:07:56 nb1 gunicorn[51095]: File "/opt/netbox-3.4.1/venv/lib/python3.9/site-packages/django/contrib/auth/mixins.py", line 109, in dispatch Jan 24 09:07:56 nb1 gunicorn[51095]: return super().dispatch(request, args, kwargs) Jan 24 09:07:56 nb1 gunicorn[51095]: File "/opt/netbox-3.4.1/venv/lib/python3.9/site-packages/django/views/generic/base.py", line 142, in dispatch Jan 24 09:07:56 nb1 gunicorn[51095]: return handler(request, *args, **kwargs) Jan 24 09:07:56 nb1 gunicorn[51095]: File "/opt/netbox-3.4.1/venv/lib/python3.9/site-packages/netbox_proxbox/views.py", line 46, in get Jan 24 09:07:56 nb1 gunicorn[51095]: update_all_result = proxbox_api.update.all(remove_unused = True) Jan 24 09:07:56 nb1 gunicorn[51095]: File "/opt/netbox-3.4.1/venv/lib/python3.9/site-packages/netbox_proxbox/proxbox_api/update.py", line 420, in all Jan 24 09:07:56 nb1 gunicorn[51095]: node_updated = nodes(proxmox_json = px_node_each, proxmox_cluster = proxmox_cluster) Jan 24 09:07:56 nb1 gunicorn[51095]: File "/opt/netbox-3.4.1/venv/lib/python3.9/site-packages/netbox_proxbox/proxbox_api/update.py", line 347, in nodes Jan 24 09:07:56 nb1 gunicorn[51095]: netbox_node = create.dcim.node(proxmox_json) Jan 24 09:07:56 nb1 gunicorn[51095]: File "/opt/netbox-3.4.1/venv/lib/python3.9/site-packages/netbox_proxbox/proxbox_api/create/dcim.py", line 146, in node Jan 24 09:07:56 nb1 gunicorn[51095]: node_json["device_type"] = device_type().id Jan 24 09:07:56 nb1 gunicorn[51095]: AttributeError: 'str' object has no attribute 'id'

proxbox version is 0.0.4. Any suggestions?

Chankster commented 1 year ago

Is this a fresh install or was it previously working and broke?

syswipe commented 1 year ago

@Chankster , it's a fresh installation.

Chankster commented 1 year ago

Can you doublecheck your plugin config settings per #59 ?

syswipe commented 1 year ago

@Chankster I've solved this problem. My NetBox instance works behind the Nginx reverse proxy. Nginx returned a 301 redirect to the https version of the NetBox instance on port 80. This behavior caused a problem with proxbox...

Chankster commented 1 year ago

Excellent, thanks for confirming.