[PR #9256] [MERGED] Fix #9122 - Clear the cache when running the upgrade script #13448

Closed
opened 2025-12-29 22:27:28 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/9256
Author: @kkthxbye-code
Created: 4/29/2022
Status: Merged
Merged: 5/4/2022
Merged by: @jeremystretch

Base: developHead: fix-9122


📝 Commits (2)

  • 7b5625a Add management command for clearing cache
  • 9f3846e Clear the cache when running the upgrade script

📊 Changes

2 files changed (+16 additions, -0 deletions)

View changed files

netbox/extras/management/commands/clearcache.py (+11 -0)
📝 upgrade.sh (+5 -0)

📄 Description

Fixes: #9122

  • Adds a clearcache management command.
  • Runs the clearcache command when running upgrade.sh

Clearing the cache on upgrade prevents having a stale openapi definition.

I have an alternative version not adding a command and just calling manage.py shell -i python .c <COMMAND>, however the clearcache command can also be use to clear for example the "new update" notification, which has been mentioned as an issue a couple of times (https://github.com/netbox-community/netbox/discussions/8800).


🔄 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/9256 **Author:** [@kkthxbye-code](https://github.com/kkthxbye-code) **Created:** 4/29/2022 **Status:** ✅ Merged **Merged:** 5/4/2022 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `develop` ← **Head:** `fix-9122` --- ### 📝 Commits (2) - [`7b5625a`](https://github.com/netbox-community/netbox/commit/7b5625a722a9b3e69636ffe3a89b9d314a1ce8e3) Add management command for clearing cache - [`9f3846e`](https://github.com/netbox-community/netbox/commit/9f3846ec5f3d9f8fdb0b9758e00d81b0df623989) Clear the cache when running the upgrade script ### 📊 Changes **2 files changed** (+16 additions, -0 deletions) <details> <summary>View changed files</summary> ➕ `netbox/extras/management/commands/clearcache.py` (+11 -0) 📝 `upgrade.sh` (+5 -0) </details> ### 📄 Description ### Fixes: #9122 * Adds a clearcache management command. * Runs the clearcache command when running upgrade.sh Clearing the cache on upgrade prevents having a stale openapi definition. I have an alternative version not adding a command and just calling `manage.py shell -i python .c <COMMAND>`, however the clearcache command can also be use to clear for example the "new update" notification, which has been mentioned as an issue a couple of times (https://github.com/netbox-community/netbox/discussions/8800). --- <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-29 22:27:28 +01:00
adam closed this issue 2025-12-29 22:27:28 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#13448