Updated files are not updated when syncing a DataSource #7598

Closed
opened 2025-12-29 20:25:53 +01:00 by adam · 1 comment
Owner

Originally created by @kkthxbye-code on GitHub (Feb 3, 2023).

Originally assigned to: @jeremystretch on GitHub.

NetBox version

v3.5.0-dev

Python version

3.10

Steps to Reproduce

  1. Create a DataSouce pointing to a local directory
  2. Create a file in the local directory
  3. Sync the DataSource
  4. Change the contents of the file in the local directory
  5. Sync the DataSource again

Expected Behavior

The contents of the file should be updated.

Observed Behavior

The file is not updated, only the file hash is.

I believe this:

a461123336/netbox/core/models/data.py (L171)

Should be changed to this:

updated_count = DataFile.objects.bulk_update(updated_files, ['hash', 'last_updated', 'size', 'data'])

Originally created by @kkthxbye-code on GitHub (Feb 3, 2023). Originally assigned to: @jeremystretch on GitHub. ### NetBox version v3.5.0-dev ### Python version 3.10 ### Steps to Reproduce 1. Create a DataSouce pointing to a local directory 2. Create a file in the local directory 3. Sync the DataSource 4. Change the contents of the file in the local directory 5. Sync the DataSource again ### Expected Behavior The contents of the file should be updated. ### Observed Behavior The file is not updated, only the file hash is. I believe this: https://github.com/netbox-community/netbox/blob/a46112333666660db6d899445b13f8ea97423d52/netbox/core/models/data.py#L171 Should be changed to this: ```updated_count = DataFile.objects.bulk_update(updated_files, ['hash', 'last_updated', 'size', 'data'])```
adam added the type: bugstatus: acceptedbeta labels 2025-12-29 20:25:53 +01:00
adam closed this issue 2025-12-29 20:25:54 +01:00
Author
Owner

@jeremystretch commented on GitHub (Feb 3, 2023):

Whoops, yeah. I had stripped those out at some point during testing. Thanks!

@jeremystretch commented on GitHub (Feb 3, 2023): Whoops, yeah. I had stripped those out at some point during testing. Thanks!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#7598