Running reports via the API no longer works - object is not callable error #8883

Closed
opened 2025-12-29 20:42:28 +01:00 by adam · 3 comments
Owner

Originally created by @olegbliaher on GitHub (Nov 24, 2023).

Originally assigned to: @isodude on GitHub.

NetBox version

3.6.5

Python version

3.9

Steps to Reproduce

curl -X POST https://netbox.oderland.net/api/extras/reports/category.MyReport/run/ -H "Authorization: Token $TOKEN"

Expected Behavior

I expect the report to run. This worked until 3.6.5.

Observed Behavior

Traceback (most recent call last):
File "/usr/lib/netbox/venv/lib/python3.9/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
File "/usr/lib/netbox/venv/lib/python3.9/site-packages/django/core/handlers/base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/netbox/venv/lib/python3.9/site-packages/django/views/decorators/csrf.py", line 56, in wrapper_view
return view_func(*args, **kwargs)
File "/usr/lib/netbox/venv/lib/python3.9/site-packages/rest_framework/viewsets.py", line 125, in view
return self.dispatch(request, *args, **kwargs)
File "/usr/lib/netbox/venv/lib/python3.9/site-packages/rest_framework/views.py", line 509, in dispatch
response = self.handle_exception(exc)
File "/usr/lib/netbox/venv/lib/python3.9/site-packages/rest_framework/views.py", line 469, in handle_exception
self.raise_uncaught_exception(exc)
File "/usr/lib/netbox/venv/lib/python3.9/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
raise exc
File "/usr/lib/netbox/venv/lib/python3.9/site-packages/rest_framework/views.py", line 506, in dispatch
response = handler(request, *args, **kwargs)
File "/usr/lib/netbox/app/extras/api/views.py", line 286, in run
report = report_cls()
TypeError: 'MyReport' object is not callable

Originally created by @olegbliaher on GitHub (Nov 24, 2023). Originally assigned to: @isodude on GitHub. ### NetBox version 3.6.5 ### Python version 3.9 ### Steps to Reproduce curl -X POST https://netbox.oderland.net/api/extras/reports/category.MyReport/run/ -H "Authorization: Token $TOKEN" ### Expected Behavior I expect the report to run. This worked until 3.6.5. ### Observed Behavior Traceback (most recent call last): File "/usr/lib/netbox/venv/lib/python3.9/site-packages/django/core/handlers/exception.py", line 55, in inner response = get_response(request) File "/usr/lib/netbox/venv/lib/python3.9/site-packages/django/core/handlers/base.py", line 197, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/usr/lib/netbox/venv/lib/python3.9/site-packages/django/views/decorators/csrf.py", line 56, in wrapper_view return view_func(*args, **kwargs) File "/usr/lib/netbox/venv/lib/python3.9/site-packages/rest_framework/viewsets.py", line 125, in view return self.dispatch(request, *args, **kwargs) File "/usr/lib/netbox/venv/lib/python3.9/site-packages/rest_framework/views.py", line 509, in dispatch response = self.handle_exception(exc) File "/usr/lib/netbox/venv/lib/python3.9/site-packages/rest_framework/views.py", line 469, in handle_exception self.raise_uncaught_exception(exc) File "/usr/lib/netbox/venv/lib/python3.9/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception raise exc File "/usr/lib/netbox/venv/lib/python3.9/site-packages/rest_framework/views.py", line 506, in dispatch response = handler(request, *args, **kwargs) File "/usr/lib/netbox/app/extras/api/views.py", line 286, in run report = report_cls() TypeError: 'MyReport' object is not callable
adam added the type: bugstatus: acceptedseverity: medium labels 2025-12-29 20:42:28 +01:00
adam closed this issue 2025-12-29 20:42:29 +01:00
Author
Owner

@isodude commented on GitHub (Nov 25, 2023):

Fixed in 8128891cea you can assigne me this issue.

@isodude commented on GitHub (Nov 25, 2023): Fixed in https://github.com/isodude/netbox/commit/8128891ceaeeef96932546cbcf23e05929c0ca28 you can assigne me this issue.
Author
Owner

@jeremystretch commented on GitHub (Nov 28, 2023):

@isodude initializing the report instance there is intentional; it's not sufficient to simply remove the call.

@jeremystretch commented on GitHub (Nov 28, 2023): @isodude initializing the report instance there is intentional; it's not sufficient to simply remove the call.
Author
Owner

@jeremystretch commented on GitHub (Nov 28, 2023):

@isodude just found your note here; you're correct, this change resolves the bug. The get_module_and_report() function has been modified to return an instance rather than the report class.

I've assigned this to you if you'd like to put in a PR; if not I'm happy to take it. Thanks for digging into it!

@jeremystretch commented on GitHub (Nov 28, 2023): @isodude just found your note [here](https://github.com/netbox-community/netbox/commit/ef460a38edd2c02d2fd887eb00f8599345550ea2#commitcomment-133412776); you're correct, this change resolves the bug. The `get_module_and_report()` function has been modified to return an instance rather than the report class. I've assigned this to you if you'd like to put in a PR; if not I'm happy to take it. Thanks for digging into it!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#8883