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

CLI run of reports hangs forever, and log shows "no attribute username" error #14892

Closed
eric-eisenhart opened this issue Jan 22, 2024 · 0 comments · Fixed by #14893
Closed

CLI run of reports hangs forever, and log shows "no attribute username" error #14892

eric-eisenhart opened this issue Jan 22, 2024 · 0 comments · Fixed by #14893
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

@eric-eisenhart
Copy link

Deployment Type

Self-hosted

NetBox Version

v3.7.1

Python Version

3.11

Steps to Reproduce

  1. Add any report to Netbox. This one is "CruftCustomFields.py", but I can reproduce with any report.
  2. Run via web UI.
  3. Run via CLI with /opt/netbox/venv/bin/python3 /opt/netbox/netbox/manage.py runreport --verbosity 3 CruftCustomFields.py

Expected Behavior

If running it via the web UI works, then running it via the CLI would also work.

Also, if running via CLI fails, exit with error instead of hanging.

Alternately, if report requires a username, some way for manage.py runreport to specify the username to run it as.

Observed Behavior

Report works fine via web UI.

Via CLI, output is

[18:32:11] Running CruftCustomFields.CruftCustomFields..

and just sits there until interrupted.

netbox.log shows

2024-01-22 10:32:11,620 INFO default: extras.reports.run_report(job=<Job: da94b31a-7d7d-4258-8965-9047af161546>) (da94b31a-7d7d-4258-8965-9047af161546)
2024-01-22 10:32:11,653 ERROR [Job da94b31a-7d7d-4258-8965-9047af161546]: exception raised while executing (extras.reports.run_report)
Traceback (most recent call last):
  File "/opt/netbox/venv/lib/python3.11/site-packages/rq/worker.py", line 1428, in perform_job
    rv = job.perform()
         ^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.11/site-packages/rq/job.py", line 1278, in perform
    self._result = self._execute()
                   ^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.11/site-packages/rq/job.py", line 1315, in _execute
    result = self.func(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/netbox/extras/reports.py", line 36, in run_report
    job.start()
  File "/opt/netbox/netbox/core/models/jobs.py", line 176, in start
    job_start.send(self)
  File "/opt/netbox/venv/lib/python3.11/site-packages/django/dispatch/dispatcher.py", line 176, in send
    return [
           ^
  File "/opt/netbox/venv/lib/python3.11/site-packages/django/dispatch/dispatcher.py", line 177, in <listcomp>
    (receiver, receiver(signal=self, sender=sender, **named))
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/netbox/extras/signals.py", line 254, in process_job_start_event_rules
    process_event_rules(event_rules, sender.object_type.model, EVENT_JOB_START, sender.data, sender.user.username)
                                                                                             ^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'username'
@eric-eisenhart eric-eisenhart added the type: bug A confirmed report of unexpected behavior in the application label Jan 22, 2024
@jeremystretch jeremystretch added severity: medium Results in substantial degraded or broken functionality for specfic workflows status: accepted This issue has been accepted for implementation labels Jan 22, 2024
@jeremystretch jeremystretch self-assigned this Jan 22, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 22, 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.

2 participants