netbox-proxbox: Error creating PVE node when there's existing Netbox device with the same name (duplicate)

I have set up the netbox-proxbox plugin following the setup guide in the README.MD

I also modified the models.py file to get it working with the newer netbox version

When I try to sync Proxmox to Netbox I get the following error:

<class 'AttributeError'>

'NoneType' object has no attribute 'name'

Python version: 3.10.6
NetBox version: 3.4.3

The stacktrace in the logs is as follows:

Jan 31 12:52:51 netbox-new-ubuntu gunicorn[7821]: Internal Server Error: /plugins/proxbox/full_update/
Jan 31 12:52:51 netbox-new-ubuntu gunicorn[7821]: Traceback (most recent call last):
Jan 31 12:52:51 netbox-new-ubuntu gunicorn[7821]:   File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/handlers/exception.py", line 55, in inner
Jan 31 12:52:51 netbox-new-ubuntu gunicorn[7821]:     response = get_response(request)
Jan 31 12:52:51 netbox-new-ubuntu gunicorn[7821]:   File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/handlers/base.py", line 197, in _get_response
Jan 31 12:52:51 netbox-new-ubuntu gunicorn[7821]:     response = wrapped_callback(request, *callback_args, **callback_kwargs)
Jan 31 12:52:51 netbox-new-ubuntu gunicorn[7821]:   File "/opt/netbox/venv/lib/python3.10/site-packages/django/views/generic/base.py", line 103, in view
Jan 31 12:52:51 netbox-new-ubuntu gunicorn[7821]:     return self.dispatch(request, *args, **kwargs)
Jan 31 12:52:51 netbox-new-ubuntu gunicorn[7821]:   File "/opt/netbox/venv/lib/python3.10/site-packages/django/contrib/auth/mixins.py", line 109, in dispatch
Jan 31 12:52:51 netbox-new-ubuntu gunicorn[7821]:     return super().dispatch(request, *args, **kwargs)
Jan 31 12:52:51 netbox-new-ubuntu gunicorn[7821]:   File "/opt/netbox/venv/lib/python3.10/site-packages/django/views/generic/base.py", line 142, in dispatch
Jan 31 12:52:51 netbox-new-ubuntu gunicorn[7821]:     return handler(request, *args, **kwargs)
Jan 31 12:52:51 netbox-new-ubuntu gunicorn[7821]:   File "/opt/netbox/netbox/netbox-proxbox/netbox_proxbox/views.py", line 46, in get
Jan 31 12:52:51 netbox-new-ubuntu gunicorn[7821]:     update_all_result = proxbox_api.update.all(remove_unused = True)
Jan 31 12:52:51 netbox-new-ubuntu gunicorn[7821]:   File "/opt/netbox/netbox/netbox-proxbox/netbox_proxbox/proxbox_api/update.py", line 420, in all
Jan 31 12:52:51 netbox-new-ubuntu gunicorn[7821]:     node_updated = nodes(proxmox_json = px_node_each, proxmox_cluster = proxmox_cluster)
Jan 31 12:52:51 netbox-new-ubuntu gunicorn[7821]:   File "/opt/netbox/netbox/netbox-proxbox/netbox_proxbox/proxbox_api/update.py", line 378, in nodes
Jan 31 12:52:51 netbox-new-ubuntu gunicorn[7821]:     full_update = node_full_update(netbox_node, proxmox_json, proxmox_cluster)
Jan 31 12:52:51 netbox-new-ubuntu gunicorn[7821]:   File "/opt/netbox/netbox/netbox-proxbox/netbox_proxbox/proxbox_api/update.py", line 57, in node_full_update
Jan 31 12:52:51 netbox-new-ubuntu gunicorn[7821]:     cluster_updated = updates.node.cluster(netbox_node, proxmox_json, proxmox_cluster)
Jan 31 12:52:51 netbox-new-ubuntu gunicorn[7821]:   File "/opt/netbox/netbox/netbox-proxbox/netbox_proxbox/proxbox_api/updates/node.py", line 52, in cluster
Jan 31 12:52:51 netbox-new-ubuntu gunicorn[7821]:     if netbox_node.cluster.name != proxmox_cluster['name']:
Jan 31 12:52:51 netbox-new-ubuntu gunicorn[7821]: AttributeError: 'NoneType' object has no attribute 'name'

I do see some stuff being created in netbox like the Cluster (with the correct name) and the cluster type and tag so it seems the connection between the plugin, Netbox and Proxmox works. What could be causing this issue?

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 24 (13 by maintainers)

Commits related to this issue

Most upvoted comments

I seem to have found the reason the plugin is throwing the error. When setting up the devices to include the idrac interfaces and virtual bridges the plugin started crashing again.

Whenever I add an extra interface to one of the hosts that gets updated by proxbox the plugin fails. When I add an MTU to the interface it gets another error than the one we experienced above. Is adding extra interfaces to the proxbox nodes unsupported or is this a bug?

So after adding another interface (idrac) and giving it an MTU i get the following error:

Mar 20 15:03:35 netbox-ubuntu gunicorn[90603]: [Proxbox - Netbox plugin | Update All]
Mar 20 15:03:35 netbox-ubuntu gunicorn[90603]: CLUSTER...
Mar 20 15:03:35 netbox-ubuntu gunicorn[90603]: [OK] CLUSTER created. -> PVE-app-cluster
Mar 20 15:03:35 netbox-ubuntu gunicorn[90603]: NODES...
Mar 20 15:03:36 netbox-ubuntu gunicorn[90603]: Internal Server Error: /plugins/proxbox/full_update/
Mar 20 15:03:36 netbox-ubuntu gunicorn[90603]: Traceback (most recent call last):
Mar 20 15:03:36 netbox-ubuntu gunicorn[90603]:   File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/handlers/exception.py", line 56, in inner
Mar 20 15:03:36 netbox-ubuntu gunicorn[90603]:     response = get_response(request)
Mar 20 15:03:36 netbox-ubuntu gunicorn[90603]:   File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/handlers/base.py", line 197, in _get_response
Mar 20 15:03:36 netbox-ubuntu gunicorn[90603]:     response = wrapped_callback(request, *callback_args, **callback_kwargs)
Mar 20 15:03:36 netbox-ubuntu gunicorn[90603]:   File "/opt/netbox/venv/lib/python3.10/site-packages/django/views/generic/base.py", line 103, in view
Mar 20 15:03:36 netbox-ubuntu gunicorn[90603]:     return self.dispatch(request, *args, **kwargs)
Mar 20 15:03:36 netbox-ubuntu gunicorn[90603]:   File "/opt/netbox/venv/lib/python3.10/site-packages/django/contrib/auth/mixins.py", line 109, in dispatch
Mar 20 15:03:36 netbox-ubuntu gunicorn[90603]:     return super().dispatch(request, *args, **kwargs)
Mar 20 15:03:36 netbox-ubuntu gunicorn[90603]:   File "/opt/netbox/venv/lib/python3.10/site-packages/django/views/generic/base.py", line 142, in dispatch
Mar 20 15:03:36 netbox-ubuntu gunicorn[90603]:     return handler(request, *args, **kwargs)
Mar 20 15:03:36 netbox-ubuntu gunicorn[90603]:   File "/opt/netbox/netbox/netbox-proxbox/netbox_proxbox/views.py", line 93, in get
Mar 20 15:03:36 netbox-ubuntu gunicorn[90603]:     "virtualmachines_table": VMUpdateResult(proxbox_api.update.all(remove_unused = True)["virtualmachines"]),
Mar 20 15:03:36 netbox-ubuntu gunicorn[90603]:   File "/opt/netbox/netbox/netbox-proxbox/netbox_proxbox/proxbox_api/update.py", line 434, in all
Mar 20 15:03:36 netbox-ubuntu gunicorn[90603]:     node_updated = nodes(proxmox_json = px_node_each, proxmox_cluster = proxmox_cluster)
Mar 20 15:03:36 netbox-ubuntu gunicorn[90603]:   File "/opt/netbox/netbox/netbox-proxbox/netbox_proxbox/proxbox_api/update.py", line 392, in nodes
Mar 20 15:03:36 netbox-ubuntu gunicorn[90603]:     full_update = node_full_update(netbox_node, proxmox_json, proxmox_cluster)
Mar 20 15:03:36 netbox-ubuntu gunicorn[90603]:   File "/opt/netbox/netbox/netbox-proxbox/netbox_proxbox/proxbox_api/update.py", line 61, in node_full_update
Mar 20 15:03:36 netbox-ubuntu gunicorn[90603]:     interfaces_updated = updates.node.interfaces(netbox_node, proxmox_json)
Mar 20 15:03:36 netbox-ubuntu gunicorn[90603]:   File "/opt/netbox/netbox/netbox-proxbox/netbox_proxbox/proxbox_api/updates/node.py", line 219, in interfaces
Mar 20 15:03:36 netbox-ubuntu gunicorn[90603]:     ntb_iface = list(nb.dcim.interfaces.filter(device_id=netbox_node.id, name=iface['name']))
Mar 20 15:03:36 netbox-ubuntu gunicorn[90603]: TypeError: string indices must be integers

Could you please open other issue to report this interface related problem?

Thank you for providing useful information, I will let this Issue open while I work on the defintive solution.

Have you created another device with the same name as the PVE’s? Like slc-app-02

Hello there!

I installed the plugin again (through git this time with the develop branch) and tested it again. I still get the same issue though. I have attached the log again below but it seems to be the exact same result as I got a while ago.

Mar 13 10:48:36 netbox-ubuntu gunicorn[45182]: [Proxbox - Netbox plugin | Update All]
Mar 13 10:48:37 netbox-ubuntu gunicorn[45182]: CLUSTER...
Mar 13 10:48:37 netbox-ubuntu gunicorn[45182]: [OK] CLUSTER created. -> PVE-app-cluster
Mar 13 10:48:37 netbox-ubuntu gunicorn[45182]: NODES...
Mar 13 10:48:37 netbox-ubuntu gunicorn[45182]: Internal Server Error: /plugins/proxbox/full_update/
Mar 13 10:48:37 netbox-ubuntu gunicorn[45182]: Traceback (most recent call last):
Mar 13 10:48:37 netbox-ubuntu gunicorn[45182]:   File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/handlers/exception.py", line 56, in inner
Mar 13 10:48:37 netbox-ubuntu gunicorn[45182]:     response = get_response(request)
Mar 13 10:48:37 netbox-ubuntu gunicorn[45182]:   File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/handlers/base.py", line 197, in _get_response
Mar 13 10:48:37 netbox-ubuntu gunicorn[45182]:     response = wrapped_callback(request, *callback_args, **callback_kwargs)
Mar 13 10:48:37 netbox-ubuntu gunicorn[45182]:   File "/opt/netbox/venv/lib/python3.10/site-packages/django/views/generic/base.py", line 103, in view
Mar 13 10:48:37 netbox-ubuntu gunicorn[45182]:     return self.dispatch(request, *args, **kwargs)
Mar 13 10:48:37 netbox-ubuntu gunicorn[45182]:   File "/opt/netbox/venv/lib/python3.10/site-packages/django/contrib/auth/mixins.py", line 109, in dispatch
Mar 13 10:48:37 netbox-ubuntu gunicorn[45182]:     return super().dispatch(request, *args, **kwargs)
Mar 13 10:48:37 netbox-ubuntu gunicorn[45182]:   File "/opt/netbox/venv/lib/python3.10/site-packages/django/views/generic/base.py", line 142, in dispatch
Mar 13 10:48:37 netbox-ubuntu gunicorn[45182]:     return handler(request, *args, **kwargs)
Mar 13 10:48:37 netbox-ubuntu gunicorn[45182]:   File "/opt/netbox/netbox/netbox-proxbox/netbox_proxbox/views.py", line 54, in get
Mar 13 10:48:37 netbox-ubuntu gunicorn[45182]:     update_all_result = proxbox_api.update.all(remove_unused = True)
Mar 13 10:48:37 netbox-ubuntu gunicorn[45182]:   File "/opt/netbox/netbox/netbox-proxbox/netbox_proxbox/proxbox_api/update.py", line 425, in all
Mar 13 10:48:37 netbox-ubuntu gunicorn[45182]:     node_updated = nodes(proxmox_json = px_node_each, proxmox_cluster = proxmox_cluster)
Mar 13 10:48:37 netbox-ubuntu gunicorn[45182]:   File "/opt/netbox/netbox/netbox-proxbox/netbox_proxbox/proxbox_api/update.py", line 383, in nodes
Mar 13 10:48:37 netbox-ubuntu gunicorn[45182]:     full_update = node_full_update(netbox_node, proxmox_json, proxmox_cluster)
Mar 13 10:48:37 netbox-ubuntu gunicorn[45182]:   File "/opt/netbox/netbox/netbox-proxbox/netbox_proxbox/proxbox_api/update.py", line 60, in node_full_update
Mar 13 10:48:37 netbox-ubuntu gunicorn[45182]:     cluster_updated = updates.node.cluster(netbox_node, proxmox_json, proxmox_cluster)
Mar 13 10:48:37 netbox-ubuntu gunicorn[45182]:   File "/opt/netbox/netbox/netbox-proxbox/netbox_proxbox/proxbox_api/updates/node.py", line 64, in cluster
Mar 13 10:48:37 netbox-ubuntu gunicorn[45182]:     if netbox_node.cluster.name != proxmox_cluster['name']:
Mar 13 10:48:37 netbox-ubuntu gunicorn[45182]: AttributeError: 'NoneType' object has no attribute 'name'

Thank you for testing, I will try to solve this and comeback to see if it works.