[PR #19418] [MERGED] 19381 fix data file script sync #15646

Closed
opened 2025-12-30 00:23:11 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/19418
Author: @arthanson
Created: 5/6/2025
Status: Merged
Merged: 5/12/2025
Merged by: @bctiemann

Base: mainHead: 19381-script


📝 Commits (1)

  • aac333a 19381 fix data file script sync

📊 Changes

1 file changed (+3 additions, -11 deletions)

View changed files

📝 netbox/core/models/files.py (+3 -11)

📄 Description

Fixes: #19381

Fix could be a one liner:
new_file.write(self.data) -> new_file.write(self.data_file.data)

However the _write_to_disk is only ever called in sync_data if a data_file so just collapsed the function to be inline and then it can be simplified, the line if storage.exists(path) and not overwrite: will never evaluate to True as overwrite was always passed as True so this can be removed.

Note: This only effects the data_file path so should have no effect on S3 storage or local file storage for scripts.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/19418 **Author:** [@arthanson](https://github.com/arthanson) **Created:** 5/6/2025 **Status:** ✅ Merged **Merged:** 5/12/2025 **Merged by:** [@bctiemann](https://github.com/bctiemann) **Base:** `main` ← **Head:** `19381-script` --- ### 📝 Commits (1) - [`aac333a`](https://github.com/netbox-community/netbox/commit/aac333a6d483fea0a12303f2f8147d09f6350d6f) 19381 fix data file script sync ### 📊 Changes **1 file changed** (+3 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `netbox/core/models/files.py` (+3 -11) </details> ### 📄 Description ### Fixes: #19381 Fix could be a one liner: `new_file.write(self.data)` -> `new_file.write(self.data_file.data)` However the _write_to_disk is only ever called in sync_data if a data_file so just collapsed the function to be inline and then it can be simplified, the line `if storage.exists(path) and not overwrite:` will never evaluate to True as overwrite was always passed as True so this can be removed. Note: This only effects the data_file path so should have no effect on S3 storage or local file storage for scripts. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-30 00:23:11 +01:00
adam closed this issue 2025-12-30 00:23:12 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#15646