Missing Django ContentType (extras | reportresult) after update to 2.9.1 #4040

Closed
opened 2025-12-29 18:32:46 +01:00 by adam · 10 comments
Owner

Originally created by @rebortg on GitHub (Aug 28, 2020).

Environment

  • Python version: 3.6
  • NetBox version: 2.9.1

Steps to Reproduce

  1. upgrade from 2.8.9 to 2.9.1
  2. test the permissions for report
    I also sadly can't repoduce this with an update fom a fresh 2.8.9 to 2.9.1

Expected Behavior

Can set the permission for the reportresult views

Observed Behavior

Can't set the permission

I have a prod and a test system with this error.

In a fresh install of 2.9.1 all is fine.
The diff is the content of the django_content_type table:

fresh 2.9.1:

>>> from django.contrib.contenttypes.models import ContentType
>>> ContentType.objects.count()
85
>>> ContentType.objects.filter(app_label="extras", model="reportresult")
<QuerySet [<ContentType: reportresult>]>

in my upgraded 2.9.1:

>>> from django.contrib.contenttypes.models import ContentType
>>> ContentType.objects.count()
84
>>> ContentType.objects.filter(app_label="extras", model="reportresult")
<QuerySet []>

in my test system i manually add the missing ContentType, this worked and the permission will be fixed.
Does this somehow have an effect in the future?

Originally created by @rebortg on GitHub (Aug 28, 2020). <!-- NOTE: IF YOUR ISSUE DOES NOT FOLLOW THIS TEMPLATE, IT WILL BE CLOSED. This form is only for reproducible bugs. If you need assistance with NetBox installation, or if you have a general question, DO NOT open an issue. Instead, post to our mailing list: https://groups.google.com/forum/#!forum/netbox-discuss Please describe the environment in which you are running NetBox. Be sure that you are running an unmodified instance of the latest stable release before submitting a bug report, and that any plugins have been disabled. --> ### Environment * Python version: 3.6 * NetBox version: 2.9.1 <!-- Describe in detail the exact steps that someone else can take to reproduce this bug using the current stable release of NetBox. Begin with the creation of any necessary database objects and call out every operation being performed explicitly. If reporting a bug in the REST API, be sure to reconstruct the raw HTTP request(s) being made: Don't rely on a client library such as pynetbox. --> ### Steps to Reproduce 1. upgrade from 2.8.9 to 2.9.1 2. test the permissions for report I also sadly can't repoduce this with an update fom a fresh 2.8.9 to 2.9.1 <!-- What did you expect to happen? --> ### Expected Behavior Can set the permission for the reportresult views <!-- What happened instead? --> ### Observed Behavior Can't set the permission I have a prod and a test system with this error. In a fresh install of 2.9.1 all is fine. The diff is the content of the django_content_type table: fresh 2.9.1: ``` >>> from django.contrib.contenttypes.models import ContentType >>> ContentType.objects.count() 85 >>> ContentType.objects.filter(app_label="extras", model="reportresult") <QuerySet [<ContentType: reportresult>]> ``` in my upgraded 2.9.1: ``` >>> from django.contrib.contenttypes.models import ContentType >>> ContentType.objects.count() 84 >>> ContentType.objects.filter(app_label="extras", model="reportresult") <QuerySet []> ``` in my test system i manually add the missing ContentType, this worked and the permission will be fixed. Does this somehow have an effect in the future?
adam closed this issue 2025-12-29 18:32:46 +01:00
Author
Owner

@jeremystretch commented on GitHub (Aug 31, 2020):

I also sadly can't repoduce this with an update fom a fresh 2.8.9 to 2.9.1

Then it's unlikely anyone else will be able to either. Without complete instructions for reproducing the reported bug, this isn't actionable.

Can set the permission for the reportresult views

The ReportResult model no longer exists in v2.9.1.

@jeremystretch commented on GitHub (Aug 31, 2020): > I also sadly can't repoduce this with an update fom a fresh 2.8.9 to 2.9.1 Then it's unlikely anyone else will be able to either. Without complete instructions for reproducing the reported bug, this isn't actionable. > Can set the permission for the reportresult views The ReportResult model no longer exists in v2.9.1.
Author
Owner

@rebortg commented on GitHub (Aug 31, 2020):

strange, i try a upgrade path from a late 2.6 version but i don't get it to reproduce.

The ReportResult model no longer exists in v2.9.1.

Yes, but in a fresh 2.9.1 the Django ContentType (extras | reportresult) will be there and some views class use them as permission requirement. here

One last question, before you close this due to non-reproducibility.
As i mention i have this issue in my prod and test environment. When i add the ContentType manually (in test it worked), does this have negative effects in the future?

@rebortg commented on GitHub (Aug 31, 2020): strange, i try a upgrade path from a late 2.6 version but i don't get it to reproduce. > The ReportResult model no longer exists in v2.9.1. Yes, but in a fresh 2.9.1 the Django ContentType (extras | reportresult) will be there and some views class use them as permission requirement. [here](https://github.com/netbox-community/netbox/blob/2435c177f53186b1f9d4683377b3e73315a7e0d3/netbox/extras/views.py#L318) One last question, before you close this due to non-reproducibility. As i mention i have this issue in my prod and test environment. When i add the ContentType manually (in test it worked), does this have negative effects in the future?
Author
Owner

@jeremystretch commented on GitHub (Aug 31, 2020):

When i add the ContentType manually (in test it worked), does this have negative effects in the future?

Yes: you should never be adding content types manually.

@jeremystretch commented on GitHub (Aug 31, 2020): > When i add the ContentType manually (in test it worked), does this have negative effects in the future? Yes: you should never be adding content types manually.
Author
Owner

@rebortg commented on GitHub (Sep 1, 2020):

I don't know why, or what i have done in the past. But i get it to reproduce in a fresh 2.9.1

Steps:

  1. install a fresh 2.9.1 versin (i used netbox-docker)
  2. add a permission with all objects and all action rights
  3. add a non admin user with the permission from point 2
  4. have a simple report
  5. log in with the user

user have no permission to reports view.

  1. update to 2.9.2

user have no permission to reports view

I think the root case is the wrong permission in the ReportView?

@rebortg commented on GitHub (Sep 1, 2020): I don't know why, or what i have done in the past. But i get it to reproduce in a fresh 2.9.1 Steps: 1. install a fresh 2.9.1 versin (i used [netbox-docker](https://github.com/netbox-community/netbox-docker)) 2. add a permission with all objects and all action rights 3. add a non admin user with the permission from point 2 4. have a simple report 5. log in with the user user have no permission to reports view. 6. update to 2.9.2 user have no permission to reports view I think the root case is the wrong permission in the [ReportView](https://github.com/netbox-community/netbox/blob/2435c177f53186b1f9d4683377b3e73315a7e0d3/netbox/extras/views.py#L318)?
Author
Owner

@rebortg commented on GitHub (Sep 8, 2020):

Hi, i respect the guidelines it important to get this project clean. But shouldn't the correct order to be first accept or close the attached issue before closing the PR?
I keep my branch active, so if someone of the maintainer can reproduce the bug, you can reopen the PR.

@rebortg commented on GitHub (Sep 8, 2020): Hi, i respect the guidelines it important to get this project clean. But shouldn't the correct order to be first accept or close the attached issue before closing the PR? I keep my branch active, so if someone of the maintainer can reproduce the bug, you can reopen the PR.
Author
Owner

@jeremystretch commented on GitHub (Sep 8, 2020):

@rebortg please see the contributing guide:

Any pull request which does not relate to an accepted issue will be closed.

@jeremystretch commented on GitHub (Sep 8, 2020): @rebortg please see the [contributing guide](https://github.com/netbox-community/netbox/blob/develop/CONTRIBUTING.md): > Any pull request which does not relate to an **accepted** issue will be closed.
Author
Owner

@jeremystretch commented on GitHub (Sep 23, 2020):

I'm not 100% clear on the issue being described here. It looks like it's potentially resolved by #5137.

@jeremystretch commented on GitHub (Sep 23, 2020): I'm not 100% clear on the issue being described here. It looks like it's potentially resolved by #5137.
Author
Owner

@rebortg commented on GitHub (Sep 23, 2020):

yes, it is the case, i was on a wrong path at the beginning and think the content type was missing, but i was a wrong permission string in the report view and some other places like in the template
The PR, i link here, will solve this issue

@rebortg commented on GitHub (Sep 23, 2020): yes, it is the case, i was on a wrong path at the beginning and think the content type was missing, but i was a wrong permission string in the report view and some other places like in the template The PR, i link here, will solve this issue
Author
Owner

@jeremystretch commented on GitHub (Sep 23, 2020):

#5137 has already been resolved. Going to close this out.

@jeremystretch commented on GitHub (Sep 23, 2020): #5137 has already been resolved. Going to close this out.
Author
Owner

@jeremystretch commented on GitHub (Sep 23, 2020):

#5137 addresses the mismatch in permission evaluation among the different report views. This issue deals with the transition from the old ReportResult permissions to using the Report model directly.

@jeremystretch commented on GitHub (Sep 23, 2020): #5137 addresses the mismatch in permission evaluation among the different report views. This issue deals with the transition from the old ReportResult permissions to using the Report model directly.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#4040