netbox-proxbox icon indicating copy to clipboard operation
netbox-proxbox copied to clipboard

ValueError at /plugins/proxbox/full_update/

Open rickyosser opened this issue 4 years ago • 1 comments

Hi,

I'm trying to add the netbox-proxbox plugin to Netbox and get the following when I'm trying to do "Full update".

The script succeeded in copying 3 VMs from the proxmox cluster in addition to the node-names and cluster-name.

Then it balked on the third CT, added it twice and throws the following error:

The cluster is quite large (around 18 machines).

Thanks in advance, Rickard

Environment:


Request Method: GET
Request URL: https://<IP>/plugins/proxbox/full_update/

Django Version: 3.2.6
Python Version: 3.8.0
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.humanize',
 'cacheops',
 'corsheaders',
 'debug_toolbar',
 'django_filters',
 'django_tables2',
 'django_prometheus',
 'mptt',
 'rest_framework',
 'taggit',
 'timezone_field',
 'circuits',
 'dcim',
 'ipam',
 'extras',
 'secrets',
 'tenancy',
 'users',
 'utilities',
 'virtualization',
 'django_rq',
 'drf_yasg',
 'nextbox_ui_plugin.NextBoxUIConfig',
 'netbox_proxbox.ProxboxConfig']
Installed Middleware:
['debug_toolbar.middleware.DebugToolbarMiddleware',
 'django_prometheus.middleware.PrometheusBeforeMiddleware',
 'corsheaders.middleware.CorsMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'django.middleware.security.SecurityMiddleware',
 'netbox.middleware.ExceptionHandlingMiddleware',
 'netbox.middleware.RemoteUserMiddleware',
 'netbox.middleware.LoginRequiredMiddleware',
 'netbox.middleware.APIVersionMiddleware',
 'netbox.middleware.ObjectChangeMiddleware',
 'django_prometheus.middleware.PrometheusAfterMiddleware']



Traceback (most recent call last):
  File "/opt/netbox/venv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/opt/netbox/venv/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/opt/netbox/netbox/netbox-proxbox/netbox_proxbox/urls.py", line 19, in full_update_view
    update_all_result = proxbox_api.update.all(remove_unused = True)
  File "/opt/netbox/netbox/netbox-proxbox/netbox_proxbox/proxbox_api/update.py", line 420, in all
    node_updated = nodes(proxmox_json = px_node_each, proxmox_cluster = proxmox_cluster)
  File "/opt/netbox/netbox/netbox-proxbox/netbox_proxbox/proxbox_api/update.py", line 342, in nodes
    netbox_search = nb.dcim.devices.get(name = proxmox_node_name)
  File "/opt/netbox/venv/lib/python3.8/site-packages/pynetbox-6.1.3-py3.8.egg/pynetbox/core/endpoint.py", line 147, in get
    raise ValueError(

Exception Type: ValueError at /plugins/proxbox/full_update/
Exception Value: get() returned more than one result. Check that the kwarg(s) passed are valid for this endpoint or use filter() or all() instead.

rickyosser avatar Sep 01 '21 12:09 rickyosser

Hi @rickyosser it seems like you have two Virtual Machines or Containers with the exactly same name. I will fix it to accept duplicate names, but for now, could you change the name of one of those VM's to know if it works? Thank you!

emersonfelipesp avatar Feb 19 '22 20:02 emersonfelipesp

#75

emersonfelipesp avatar Mar 20 '23 18:03 emersonfelipesp