netbox-community / netbox-topology-views

A netbox plugin that draws topology views
Apache License 2.0
747 stars 63 forks source link

Server Error after placing devices on the view #152

Closed maxzapp closed 1 year ago

maxzapp commented 2 years ago

Hi,

i am running v3.3.2 and your actual plugin. After creating the custom field coordinates for all devices i start to shuffle all my devices in a more logical way eg. sort them by floor (custom field). I decided to create for each floor a custom link locatet to dcim-site to get quick access. During shuffeling the second floor (moste devices are there) i run into the error below. Now i cannot acces "Plugins-Topology Views" anymore. My first created custom-link to an other floor is still working (devices can be moved, filters are available)

Need help to get back to normal access via Plugins-Topology Views link.

======================= Server Error There was a problem with your request. Please contact an administrator.

The complete exception is provided below:

<class 'ValueError'>

invalid literal for int() with base 10: 'None'

Python version: 3.8.10 NetBox version: 3.3.2

mattieserver commented 2 years ago

Hi,

Thanks for reporting this. Could you maybe enable debug mode? (In the netbox config file "Debug=True") Then you should see some more info.

Please disable it again after you got the error message. If you don't feel comfortable enabling debug mode I will try to reproduce it with some more sample data.


From: maxzapp @.> Sent: Friday, September 9, 2022 6:11:12 PM To: mattieserver/netbox-topology-views @.> Cc: Subscribed @.***> Subject: [mattieserver/netbox-topology-views] Server Error after placing devices on the view (Issue #152)

Hi,

i am running v3.3.2 and your actual plugin. After creating the custom field coordinates for all devices i start to shuffle all my devices in a more logical way eg. sort them by floor (custom field). I decided to create for each floor a custom link locatet to dcim-site to get quick access. During shuffeling the second floor (moste devices are there) i run into the error below. Now i cannot acces "Plugins-Topology Views" anymore. My first created custom-link to an other floor is still working (devices can be moved, filters are available)

Need help to get back to normal access via Plugins-Topology Views link.

======================= Server Error There was a problem with your request. Please contact an administrator.

The complete exception is provided below:

<class 'ValueError'>

invalid literal for int() with base 10: 'None'

Python version: 3.8.10 NetBox version: 3.3.2

— Reply to this email directly, view it on GitHubhttps://github.com/mattieserver/netbox-topology-views/issues/152, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAXITDB2DIOTPSV2P45PHNDV5NOSBANCNFSM6AAAAAAQI2CLHQ. You are receiving this because you are subscribed to this thread.Message ID: @.***>

maxzapp commented 2 years ago

Hi

I set Debug=True . Is the a logfile somewhere or do I need to copy paste the text on screen?

I have to "clean" the log and I cannot post it open here, can I send it to you direct?

mattieserver commented 2 years ago

You should see something like this: https://i.stack.imgur.com/TJE6q.png If you can copy paste the "traceback" i should have enough info. (if that includes private info, a screenshot of the last few lines of the traceback should also be good as is need to know at which line in the plugin the error happens.

maxzapp commented 2 years ago

Hi here is the traceback:

[REDACTED] Seems like this is not the info i need, redacted it to make sure

mattieserver commented 2 years ago

hmm, will try to reproduce this

maxzapp commented 2 years ago

I was clicking the link copy and past view and copied it here, was it wrong?

maxzapp commented 2 years ago

Hi, my quick workaround solution was to select all devices in netbox I was working in that situation and set the coordinates to zero. Now the plug-in is available as normal.

maxzapp commented 2 years ago

Maby this will help you:

Environment:

Request Method: GET Request URL: https://XYZ.XYZ.XYZ.XYZ/plugins/netbox_topology_views/?device_role_id=29&device_role_id=10&device_role_id=32&device_role_id=9&device_role_id=22&device_role_id=8&draw_init=True

Django Version: 4.0.7 Python Version: 3.8.10 Installed Applications: ['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.humanize', 'corsheaders', 'debug_toolbar', 'graphiql_debug_toolbar', 'django_filters', 'django_tables2', 'django_prometheus', 'graphene_django', 'mptt', 'rest_framework', 'social_django', 'taggit', 'timezone_field', 'circuits', 'dcim', 'ipam', 'extras', 'tenancy', 'users', 'utilities', 'virtualization', 'wireless', 'django_rq', 'drf_yasg', 'netbox_interface_sync.Config', 'netbox_topology_views.TopologyViewsConfig'] Installed Middleware: ['graphiql_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.DynamicConfigMiddleware', 'netbox.middleware.APIVersionMiddleware', 'netbox.middleware.ObjectChangeMiddleware', 'django_prometheus.middleware.PrometheusAfterMiddleware']

Traceback (most recent call last): File "/opt/netbox-3.3.2/venv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 55, in inner response = get_response(request) File "/opt/netbox-3.3.2/venv/lib/python3.8/site-packages/django/core/handlers/base.py", line 197, in _get_response response = wrapped_callback(request, *callback_args, callback_kwargs) File "/opt/netbox-3.3.2/venv/lib/python3.8/site-packages/django/views/generic/base.py", line 84, in view return self.dispatch(request, *args, *kwargs) File "/opt/netbox-3.3.2/venv/lib/python3.8/site-packages/django/contrib/auth/mixins.py", line 109, in dispatch return super().dispatch(request, args, kwargs) File "/opt/netbox-3.3.2/venv/lib/python3.8/site-packages/django/views/generic/base.py", line 119, in dispatch return handler(request, *args, **kwargs) File "/opt/netbox-3.3.2/venv/lib/python3.8/site-packages/netbox_topology_views/views.py", line 353, in get topo_data = get_topology_data(self.queryset, hide_unconnected, save_coords, show_circuit, show_power) File "/opt/netbox-3.3.2/venv/lib/python3.8/site-packages/netbox_topology_views/views.py", line 312, in get_topology_data nodes.append(create_node(d, save_coords)) File "/opt/netbox-3.3.2/venv/lib/python3.8/site-packages/netbox_topology_views/views.py", line 110, in create_node node["y"] = int(cords[1])

Exception Type: ValueError at /plugins/netbox_topology_views/ Exception Value: invalid literal for int() with base 10: 'None'

dreng commented 1 year ago

The error states that it is not possible to treat or convert an empty value as integer.

My first guess is that you set the wrong type for "coordinates". It has to be "Text" and not "Integer" (see docs).

My second guess is that you have one or more NULL values in the custom field "coordinates" and/or your custom field for the floor. Double check your custom link URL aswell.

You might want to check all values at the devices view. You need to make the column visible first by clicking "Configure Table". You are also able to bulk edit the coordinates field at the devices view.

Have you tried to use the plugin directly after creating the custom field "Coordinates" or only after all changes have been made?

Anyway, doesn't seem to be a bug for me but an individual issue.