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
This commit is contained in:
Minijackson 2024-01-22 16:17:57 +01:00
parent 2ce396c65f
commit 163fed297e
No known key found for this signature in database
GPG Key ID: FEA888C9F5D64F62
7 changed files with 41 additions and 10 deletions

View File

@ -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"
'';

View File

@ -574,6 +574,7 @@ in {
networking.scripted = handleTest ./networking.nix { networkd = false; };
netbox_3_5 = handleTest ./web-apps/netbox.nix { netbox = pkgs.netbox_3_5; };
netbox_3_6 = handleTest ./web-apps/netbox.nix { netbox = pkgs.netbox_3_6; };
netbox_3_7 = handleTest ./web-apps/netbox.nix { netbox = pkgs.netbox_3_7; };
netbox-upgrade = handleTest ./web-apps/netbox-upgrade.nix {};
# TODO: put in networking.nix after the test becomes more complete
networkingProxy = handleTest ./networking-proxy.nix {};

View File

@ -1,6 +1,6 @@
import ../make-test-python.nix ({ lib, pkgs, ... }: let
oldNetbox = pkgs.netbox_3_5;
newNetbox = pkgs.netbox_3_6;
oldNetbox = pkgs.netbox_3_6;
newNetbox = pkgs.netbox_3_7;
in {
name = "netbox-upgrade";

View File

@ -3,7 +3,7 @@ let
generic = import ./generic.nix;
in
lib.fix (self: {
netbox = self.netbox_3_6;
netbox = self.netbox_3_7;
netbox_3_5 = callPackage generic {
version = "3.5.9";
@ -35,4 +35,20 @@ lib.fix (self: {
maintainers = with lib.maintainers; [ minijackson n0emis raitobezarius ];
};
netbox_3_7 = callPackage generic {
version = "3.7.1";
hash = "sha256-hAwkrrjrV+XVIYe3C8f/342SPlllXUhiFuaAp+TLMUw=";
extraPatches = [
# Allow setting the STATIC_ROOT from within the configuration and setting a custom redis URL
./config.patch
./fix-doc-link.patch
];
tests = {
netbox = nixosTests.netbox_3_7;
inherit (nixosTests) netbox-upgrade;
};
maintainers = with lib.maintainers; [ minijackson n0emis raitobezarius ];
};
})

View File

@ -0,0 +1,10 @@
diff --git a/docs/plugins/development/data-backends.md b/docs/plugins/development/data-backends.md
index feffa5bed..8b7226a41 100644
--- a/docs/plugins/development/data-backends.md
+++ b/docs/plugins/development/data-backends.md
@@ -20,4 +20,4 @@ backends = [MyDataBackend]
!!! tip
The path to the list of search indexes can be modified by setting `data_backends` in the PluginConfig instance.
-::: core.data_backends.DataBackend
+::: netbox.data_backends.DataBackend

View File

@ -58,6 +58,7 @@
pillow
psycopg2
pyyaml
requests
sentry-sdk
social-auth-core
social-auth-app-django

View File

@ -11133,7 +11133,7 @@ with pkgs;
netbootxyz-efi = callPackage ../tools/misc/netbootxyz-efi { };
inherit (callPackage ../servers/web-apps/netbox { })
netbox netbox_3_5 netbox_3_6;
netbox netbox_3_5 netbox_3_6 netbox_3_7;
netbox2netshot = callPackage ../tools/admin/netbox2netshot { };