Skip to content

Commit

Permalink
nixos/netbox: clear old static files on upgrade (#354036)
Browse files Browse the repository at this point in the history
  • Loading branch information
minijackson authored Nov 22, 2024
2 parents 8f5a6dd + fe58368 commit a25e476
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions nixos/modules/services/web-apps/netbox.nix
Original file line number Diff line number Diff line change
Expand Up @@ -298,13 +298,13 @@ in {
# This mostly correspond to upstream NetBox's 'upgrade.sh' script.
versionFile="${cfg.dataDir}/version"
if [[ -e "$versionFile" && "$(cat "$versionFile")" == "${cfg.package.version}" ]]; then
if [[ -h "$versionFile" && "$(readlink -- "$versionFile")" == "${cfg.package}" ]]; then
exit 0
fi
${pkg}/bin/netbox migrate
${pkg}/bin/netbox trace_paths --no-input
${pkg}/bin/netbox collectstatic --no-input
${pkg}/bin/netbox collectstatic --clear --no-input
${pkg}/bin/netbox remove_stale_contenttypes --no-input
${pkg}/bin/netbox reindex --lazy
${pkg}/bin/netbox clearsessions
Expand All @@ -314,7 +314,7 @@ in {
(lib.versionOlder cfg.package.version "3.7.0")
"${pkg}/bin/netbox clearcache"}
echo "${cfg.package.version}" > "$versionFile"
ln -sfn "${cfg.package}" "$versionFile"
'';

serviceConfig = defaultServiceConfig // {
Expand Down

0 comments on commit a25e476

Please sign in to comment.