infrastructure/patches/netbox.patch

51 lines
2 KiB
Diff
Raw Normal View History

2024-02-23 00:57:26 +01:00
From 163fed297ed65a24241f190d8e954ce1877f9020 Mon Sep 17 00:00:00 2001
From: Minijackson <minijackson@riseup.net>
Date: Mon, 22 Jan 2024 16:17:57 +0100
Subject: [PATCH] netbox: 3.6.9 -> 3.7.1
Or another way to see it:
netbox_3_7: init at 3.7.1
Make NetBox 3.7 the default version if stateVersion >= 24.05,
switch upgrade test to test upgrade from 3.6 to 3.7,
remove clearcache command for >=3.7.0,
make reindex command mandatory
---
nixos/modules/services/web-apps/netbox.nix | 15 +++++++++------
diff --git a/nixos/modules/services/web-apps/netbox.nix b/nixos/modules/services/web-apps/netbox.nix
index 72ec578146a764..b0921f461d2216 100644
--- a/nixos/modules/services/web-apps/netbox.nix
+++ b/nixos/modules/services/web-apps/netbox.nix
@@ -75,7 +75,9 @@ in {
package = lib.mkOption {
type = lib.types.package;
default =
- if lib.versionAtLeast config.system.stateVersion "23.11"
+ if lib.versionAtLeast config.system.stateVersion "24.05"
+ then pkgs.netbox_3_7
+ else if lib.versionAtLeast config.system.stateVersion "23.11"
then pkgs.netbox_3_6
else if lib.versionAtLeast config.system.stateVersion "23.05"
then pkgs.netbox_3_5
@@ -306,12 +308,13 @@ in {
${pkg}/bin/netbox trace_paths --no-input
${pkg}/bin/netbox collectstatic --no-input
${pkg}/bin/netbox remove_stale_contenttypes --no-input
- # TODO: remove the condition when we remove netbox_3_3
- ${lib.optionalString
- (lib.versionAtLeast cfg.package.version "3.5.0")
- "${pkg}/bin/netbox reindex --lazy"}
+ ${pkg}/bin/netbox reindex --lazy
${pkg}/bin/netbox clearsessions
- ${pkg}/bin/netbox clearcache
+ ${lib.optionalString
+ # The clearcache command was removed in 3.7.0:
+ # https://github.com/netbox-community/netbox/issues/14458
+ (lib.versionOlder cfg.package.version "3.7.0")
+ "${pkg}/bin/netbox clearcache"}
echo "${cfg.package.version}" > "$versionFile"
'';