netbox-community / netbox-topology-views

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

Image Attachments table throws exception #562

Closed ThomasGiger closed 2 weeks ago

ThomasGiger commented 2 weeks ago

NetBox version

v4.0.10

Topology Views version

v4.0.1

Steps to Reproduce

  1. Install Netbox and NTV with the above versions
  2. Attach some images somewhere
  3. Navigate to Image Attachments

Expected Behavior

Image Attachment table should open. To be honest, I haven tried this without NTV installed, but demo.netbox.dev (which is at v4.0.10 too currently) does not throw.

Observed Behavior

An exception is shown which says

<class 'django.core.exceptions.FieldError'>

Field 'parent' does not generate an automatic reverse relation and therefore cannot be used for reverse querying. If it is a GenericForeignKey, consider adding a GenericRelation.

Python version: 3.10.12 NetBox version: 4.0.10 Plugins: netbox_topology_views: 4.0.1

mattieserver commented 2 weeks ago

Can you clarify what you mean by 'Attach some images somewhere'? Where do you attach them?

ThomasGiger commented 2 weeks ago

I was referring to uploading images "into" Netbox devices, device types, racks and some other object types. This step may or may be necessary to reproduce the bug, i.e. without any images uploaded, the code might not get to the point that throws the exception. Because I cannot delete my images just for testing. So I tried on demo.netbox.dev, uploaded an image to a device and the "Image Attachments" table will list my upload/attachment. They are using 4.0.10, I do too, but I got TNV installed and run into this bug. I.e. not sure what TNV got to do with this, but it is a suspect ;-)

dreng commented 2 weeks ago

It would help much more if you would provide the exact steps to reproduce the issue. Use terms like "In the menu, navigate to xyz" and "Click 'add' button".

NTV does not use any image attachments. From this perspective it seems very unlikely that NTV is causing the bug. We use image attachments in our production environment and I don't see any such errors.

If you want uns to help, it is absolutely necessary that you provide the required information. Again, please don't explain what you did. Describe what we need to do to reproduce the error, step by step.

ThomasGiger commented 2 weeks ago

Okay, then:

  1. Attach an image to some Netbox object (recommended)
  2. Navigate to "Image Attachments" and see the exception before the table opens. Details see above.

Step 1 is recommended because I'm unsure whether you need at least one image attachment to see the problem - i.e. it could be that it doesn't show when the list is empty (no images attached anywhere).

But as you said, you use image attachments and you don't see the problem in your environment. OTOH, an installation w/o TNV doesn't show the problem either. So you may close this report for now and we'll see what future versions of Netbox and TNV will do to it.

mattieserver commented 2 weeks ago

I cant reproduce this and i dont really see what the plugin has to do with the images as we dont really interface in any way with what 'Image Attachments' shows.

Do you have the same error if you remove the plugin from the config file and restart netbox?

dreng commented 2 weeks ago

OTOH, an installation w/o TNV doesn't show the problem either.

You are comparing your own installation (including NTV) with the demo page (without NTV). That is not an adequate comparison. You may have a general problem with your installation or a corrupted database or whatever.

What you can do to clarify the situation:

Either: Remove NTV plugin from you local instance of NetBox and check if the issue persists Or: Use a fresh NetBox installation with a fresh database, install NTV and check if the issue persists

I'm converting this issue into a discussion, because NTV doesn't seem to be the issue.