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

AttributeError in auto_sync signal #12750

Closed
miaow2 opened this issue May 29, 2023 · 0 comments · Fixed by #13333
Closed

AttributeError in auto_sync signal #12750

miaow2 opened this issue May 29, 2023 · 0 comments · Fixed by #13333
Assignees
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@miaow2
Copy link
Contributor

miaow2 commented May 29, 2023

NetBox version

v3.5.2

Python version

3.10

Steps to Reproduce

  1. create DataSource with type local or git
  2. sync datasource
  3. create script from any file from datasource, auto sync must be enabled
  4. delete script
  5. sync datasource

Expected Behavior

Sync job will have Completed status

Observed Behavior

Job with DataSource sync will fail, because of AttributeError in signal auto_sync

Log in rqworker

[Job 2d561d69-63b6-4da4-aabb-0bbff4daef29]: exception raised while executing (core.jobs.sync_datasource)
Traceback (most recent call last):
  File "/opt/netbox/venv/lib/python3.10/site-packages/rq/worker.py", line 1418, in perform_job
    rv = job.perform()
  File "/opt/netbox/venv/lib/python3.10/site-packages/rq/job.py", line 1225, in perform
    self._result = self._execute()
  File "/opt/netbox/venv/lib/python3.10/site-packages/rq/job.py", line 1262, in _execute
    result = self.func(*self.args, **self.kwargs)
  File "/opt/netbox/netbox/core/jobs.py", line 33, in sync_datasource
    raise e
  File "/opt/netbox/netbox/core/jobs.py", line 20, in sync_datasource
    datasource.sync()
  File "/opt/netbox/netbox/core/models/data.py", line 202, in sync
    post_sync.send(sender=self.__class__, instance=self)
  File "/opt/netbox/venv/lib/python3.10/site-packages/django/dispatch/dispatcher.py", line 176, in send
    return [
  File "/opt/netbox/venv/lib/python3.10/site-packages/django/dispatch/dispatcher.py", line 177, in <listcomp>
    (receiver, receiver(signal=self, sender=sender, **named))
  File "/opt/netbox/netbox/core/signals.py", line 21, in auto_sync
    autosync.object.sync(save=True)
AttributeError: 'NoneType' object has no attribute 'sync'

This happens because AutoSyncRecord object does not cascade deleted after ManagedFile object is deleted

@miaow2 miaow2 added the type: bug A confirmed report of unexpected behavior in the application label May 29, 2023
@jeremystretch jeremystretch added the status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation label May 30, 2023
@arthanson arthanson self-assigned this May 31, 2023
@arthanson arthanson removed the status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation label May 31, 2023
@arthanson arthanson removed their assignment Aug 1, 2023
@arthanson arthanson added the status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation label Aug 1, 2023
@abhi1693 abhi1693 self-assigned this Aug 1, 2023
@abhi1693 abhi1693 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 Aug 1, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
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.

4 participants