Full update does not work
Hi,
Full update does not work on my cluster:
The error is:
<class 'TypeError'>
int() argument must be a string, a bytes-like object or a real number, not 'NoneType'
Python version: 3.11.2
NetBox version: 3.7.1
Plugins:
netbox_proxbox: 0.0.5
Full logs:
Feb 03 11:13:05 gunicorn[41198]: NODES...
Feb 03 11:13:06 gunicorn[41198]: Internal Server Error: /plugins/proxbox/full_update/
Feb 03 11:13:06 gunicorn[41198]: Traceback (most recent call last):
Feb 03 11:13:06 gunicorn[41198]: File "/opt/netbox/venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
Feb 03 11:13:06 gunicorn[41198]: response = get_response(request)
Feb 03 11:13:06 gunicorn[41198]: ^^^^^^^^^^^^^^^^^^^^^
Feb 03 11:13:06 gunicorn[41198]: File "/opt/netbox/venv/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
Feb 03 11:13:06 gunicorn[41198]: response = wrapped_callback(request, *callback_args, **callback_kwargs)
Feb 03 11:13:06 gunicorn[41198]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Feb 03 11:13:06 gunicorn[41198]: File "/opt/netbox/venv/lib/python3.11/site-packages/django/views/generic/base.py", line 104, in view
Feb 03 11:13:06 gunicorn[41198]: return self.dispatch(request, *args, **kwargs)
Feb 03 11:13:06 gunicorn[41198]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Feb 03 11:13:06 gunicorn[41198]: File "/opt/netbox/venv/lib/python3.11/site-packages/django/contrib/auth/mixins.py", line 109, in dispatch
Feb 03 11:13:06 gunicorn[41198]: return super().dispatch(request, *args, **kwargs)
Feb 03 11:13:06 gunicorn[41198]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Feb 03 11:13:06 gunicorn[41198]: File "/opt/netbox/venv/lib/python3.11/site-packages/django/views/generic/base.py", line 143, in dispatch
Feb 03 11:13:06 gunicorn[41198]: return handler(request, *args, **kwargs)
Feb 03 11:13:06 gunicorn[41198]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Feb 03 11:13:06 gunicorn[41198]: File "/opt/netbox/venv/lib/python3.11/site-packages/netbox_proxbox/views.py", line 93, in get
Feb 03 11:13:06 gunicorn[41198]: "virtualmachines_table": VMUpdateResult(proxbox_api.update.all(remove_unused = True)["virtualmachines"]),
Feb 03 11:13:06 gunicorn[41198]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Feb 03 11:13:06 gunicorn[41198]: File "/opt/netbox/venv/lib/python3.11/site-packages/netbox_proxbox/proxbox_api/update.py", line 434, in all
Feb 03 11:13:06 gunicorn[41198]: node_updated = nodes(proxmox_json = px_node_each, proxmox_cluster = proxmox_cluster)
Feb 03 11:13:06 gunicorn[41198]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Feb 03 11:13:06 gunicorn[41198]: File "/opt/netbox/venv/lib/python3.11/site-packages/netbox_proxbox/proxbox_api/update.py", line 392, in nodes
Feb 03 11:13:06 gunicorn[41198]: full_update = node_full_update(netbox_node, proxmox_json, proxmox_cluster)
Feb 03 11:13:06 gunicorn[41198]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Feb 03 11:13:06 gunicorn[41198]: File "/opt/netbox/venv/lib/python3.11/site-packages/netbox_proxbox/proxbox_api/update.py", line 61, in node_full_update
Feb 03 11:13:06 gunicorn[41198]: interfaces_updated = updates.node.interfaces(netbox_node, proxmox_json)
Feb 03 11:13:06 gunicorn[41198]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Feb 03 11:13:06 gunicorn[41198]: File "/opt/netbox/venv/lib/python3.11/site-packages/netbox_proxbox/proxbox_api/updates/node.py", line 104, in interfaces
Feb 03 11:13:06 gunicorn[41198]: _ntb_iface = [{'name': iface.name, 'mtu' : int(iface.mtu), 'tagged_vlans': [int(x['vid']) for x in iface.tagged_vlans]} for iface in nb.dcim.interfaces.filter(device_id=netbox_node.id)]
Feb 03 11:13:06 gunicorn[41198]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Feb 03 11:13:06 gunicorn[41198]: File "/opt/netbox/venv/lib/python3.11/site-packages/netbox_proxbox/proxbox_api/updates/node.py", line 104, in <listcomp>
Feb 03 11:13:06 gunicorn[41198]: _ntb_iface = [{'name': iface.name, 'mtu' : int(iface.mtu), 'tagged_vlans': [int(x['vid']) for x in iface.tagged_vlans]} for iface in nb.dcim.interfaces.filter(device_id=netbox_node.id)]
Feb 03 11:13:06 gunicorn[41198]: ^^^^^^^^^^^^^^
Feb 03 11:13:06 gunicorn[41198]: TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'
I'm not sure whether the MTU value is important to you or Proxbox but after getting this error I just nanoed into /opt/netbox/venv/lib/python3.11/site-packages/netbox_proxbox/proxbox_api/updates/node.py and changed 'mtu' : int(iface.mtu) to 'mtu' : 1500.
For me there was also another error lower down in the file with the line
ntb_iface = list(nb.dcim.interfaces.filter(device_id=netbox_node.id, name=iface['name']))
where I got TypeError: string indices must be integers so I removed the subscript from iface and after that Proxbox seemed to work for me.
Hope this helps
It did the tricks, thanks!
For me there was also another error lower down in the file with the line
ntb_iface = list(nb.dcim.interfaces.filter(device_id=netbox_node.id, name=iface['name']))where I got
TypeError: string indices must be integersso I removed the subscript fromifaceand after that Proxbox seemed to work for me.Hope this helps
I have this issue too but I don't follow what changes need to be made. What changes did you make on which lines?
Regards, Matt.
I have this issue too but I don't follow what changes need to be made. What changes did you make on which lines?
I can’t say which line number because I’m not sure whether our files are exactly the same but on the line (quite near the bottom)
ntb_iface = list(nb.dcim.interfaces.filter(device_id=netbox_node.id, name=iface['name']))
I changed name=iface['name'] near the end to just name=iface, since iface appears to be of type str.
To be honest I have stopped using Proxbox because I faced the same issue described in #140 and that burned me and I felt I could not trust the software anymore. The fix I described above worked and helped me with the initial import of the data. Since then I have been keeping NetBox and Proxmox in sync manually.
Thanks. I can see the changes you make reference to have already been made in master and develop branches. I am having other undefined type errors on full update and starting to get sidetracked by this. I really wanted this to work but I think I'm at the point where switching to manually adding VMs to netbox is my quicker option and I'll revisit this when I import my larger Proxmox cluster of several hundred VMs to netbox.