Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Full update does not work #167

Closed
RomLecat opened this issue Feb 3, 2024 · 6 comments
Closed

Full update does not work #167

RomLecat opened this issue Feb 3, 2024 · 6 comments
Assignees
Labels
duplicate This issue or pull request already exists

Comments

@RomLecat
Copy link

RomLecat commented Feb 3, 2024

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'
@matthewwee
Copy link

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

@RomLecat
Copy link
Author

RomLecat commented Feb 3, 2024

It did the tricks, thanks!

@ocfmatt
Copy link

ocfmatt commented Mar 13, 2024

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

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.

@matthewwee
Copy link

matthewwee commented Mar 14, 2024

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.

@ocfmatt
Copy link

ocfmatt commented Mar 14, 2024

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.

@emersonfelipesp emersonfelipesp self-assigned this Oct 24, 2024
@emersonfelipesp emersonfelipesp added the duplicate This issue or pull request already exists label Oct 24, 2024
@emersonfelipesp
Copy link
Member

#176

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

4 participants