Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
olegbliaher opened this issue Nov 24, 2023 · 3 comments · Fixed by #14376
Closed

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

olegbliaher opened this issue Nov 24, 2023 · 3 comments · Fixed by #14376
Assignees
Labels
severity: medium Results in substantial degraded or broken functionality for specfic workflows status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@olegbliaher
Copy link

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

@olegbliaher olegbliaher added the type: bug A confirmed report of unexpected behavior in the application label Nov 24, 2023
@isodude
Copy link
Contributor

isodude commented Nov 25, 2023

Fixed in isodude@8128891 you can assigne me this issue.

@jeremystretch jeremystretch assigned isodude and unassigned isodude Nov 28, 2023
@jeremystretch
Copy link
Member

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

@jeremystretch jeremystretch added status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation severity: medium Results in substantial degraded or broken functionality for specfic workflows labels Nov 28, 2023
@jeremystretch
Copy link
Member

jeremystretch commented 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 jeremystretch added status: accepted This issue has been accepted for implementation and removed status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation labels Nov 28, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
severity: medium Results in substantial degraded or broken functionality for specfic workflows status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants