Skip to content

Commit b172ae6

Browse files
Merge pull request #9256 from kkthxbye-code/fix-9122
Fix #9122 - Clear the cache when running the upgrade script
2 parents eab187f + 9f3846e commit b172ae6

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from django.core.cache import cache
2+
from django.core.management.base import BaseCommand
3+
4+
5+
class Command(BaseCommand):
6+
"""Command to clear the entire cache."""
7+
help = 'Clears the cache.'
8+
9+
def handle(self, *args, **kwargs):
10+
cache.clear()
11+
self.stdout.write('Cache has been cleared.', ending="\n")

upgrade.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,11 @@ COMMAND="python3 netbox/manage.py clearsessions"
108108
echo "Removing expired user sessions ($COMMAND)..."
109109
eval $COMMAND || exit 1
110110

111+
# Clear the cache
112+
COMMAND="python3 netbox/manage.py clearcache"
113+
echo "Clearing the cache ($COMMAND)..."
114+
eval $COMMAND || exit 1
115+
111116
if [ -v WARN_MISSING_VENV ]; then
112117
echo "--------------------------------------------------------------------"
113118
echo "WARNING: No existing virtual environment was detected. A new one has"

0 commit comments

Comments
 (0)