Unverified Commit 0433962e authored by Rémi NICOLE's avatar Rémi NICOLE Committed by GitHub
Browse files

netbox: 3.7.8 -> 4.1.3 (#331750)

parents 31eafaeb 5bf65751
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -312,6 +312,14 @@
- The method to safely handle secrets in the `networking.wireless` module has been changed to benefit from a [new feature](https://w1.fi/cgit/hostap/commit/?id=e680a51e94a33591f61edb210926bcb71217a21a) of wpa_supplicant.
  The syntax to refer to secrets has changed slightly and the option `networking.wireless.environmentFile` has been replaced by `networking.wireless.secretsFile`; see the description of the latter for how to upgrade.

- NetBox was updated to `>= 4.1.0`.
  Have a look at the breaking changes
  of the [4.0 release](https://github.com/netbox-community/netbox/releases/tag/v4.0.0)
  and the [4.1 release](https://github.com/netbox-community/netbox/releases/tag/v4.1.0),
  make the required changes to your database, if needed,
  then upgrade by setting `services.netbox.package = pkgs.netbox_4_1;`
  in your configuration.

- `services.cgit` now runs as the cgit user by default instead of root.
  This change requires granting access to the repositories to this user or
  setting the appropriate one through `services.cgit.some-instance.user`.
+9 −12
Original line number Diff line number Diff line
@@ -75,21 +75,17 @@ in {
    package = lib.mkOption {
      type = lib.types.package;
      default =
        if lib.versionAtLeast config.system.stateVersion "24.05"
        if lib.versionAtLeast config.system.stateVersion "24.11"
        then pkgs.netbox_4_1
        else 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
        else pkgs.netbox_3_3;
        else pkgs.netbox_3_6;
      defaultText = lib.literalExpression ''
        if lib.versionAtLeast config.system.stateVersion "24.05"
        if lib.versionAtLeast config.system.stateVersion "24.11"
        then pkgs.netbox_4_1
        else 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
        else pkgs.netbox_3_3;
        else pkgs.netbox_3_6;
      '';
      description = ''
        NetBox package to use.
@@ -328,6 +324,7 @@ in {
              --pythonpath ${pkg}/opt/netbox/netbox
          '';
          PrivateTmp = true;
          TimeoutStartSec = lib.mkDefault "5min";
        };
      };

+2 −0
Original line number Diff line number Diff line
@@ -658,6 +658,8 @@ in {
  networking.networkmanager = handleTest ./networking/networkmanager.nix {};
  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_4_0 = handleTest ./web-apps/netbox.nix { netbox = pkgs.netbox_4_0; };
  netbox_4_1 = handleTest ./web-apps/netbox.nix { netbox = pkgs.netbox_4_1; };
  netbox-upgrade = handleTest ./web-apps/netbox-upgrade.nix {};
  # TODO: put in networking.nix after the test becomes more complete
  networkingProxy = handleTest ./networking-proxy.nix {};
+5 −3
Original line number Diff line number Diff line
import ../make-test-python.nix ({ lib, pkgs, ... }: let
  oldNetbox = pkgs.netbox_3_6;
  newNetbox = pkgs.netbox_3_7;
  oldNetbox = pkgs.netbox_3_7;
  newNetbox = pkgs.netbox_4_1;
in {
  name = "netbox-upgrade";

@@ -58,8 +58,10 @@ in {
          return header.split()[1]

      def check_api_version(version):
          # Returns 403 with NetBox >= 4.0,
          # but we still get the API version in the headers
          headers = machine.succeed(
            "curl -sSfL http://localhost/api/ --head -H 'Content-Type: application/json'"
            "curl -sSL http://localhost/api/ --head -H 'Content-Type: application/json'"
          )
          assert api_version(headers) == version

+1 −6
Original line number Diff line number Diff line
@@ -132,7 +132,7 @@ in import ../make-test-python.nix ({ lib, pkgs, netbox, ... }: {

  testScript = let
    changePassword = pkgs.writeText "change-password.py" ''
      from django.contrib.auth.models import User
      from users.models import User
      u = User.objects.get(username='netbox')
      u.set_password('netbox')
      u.save()
@@ -171,11 +171,6 @@ in import ../make-test-python.nix ({ lib, pkgs, netbox, ... }: {
        machine.succeed("curl -sSfL http://localhost/static/netbox.js")
        machine.succeed("curl -sSfL http://localhost/static/docs/")

    with subtest("Can interact with API"):
        json.loads(
            machine.succeed("curl -sSfL -H 'Accept: application/json' 'http://localhost/api/'")
        )

    def login(username: str, password: str):
        encoded_data = json.dumps({"username": username, "password": password})
        uri = "/users/tokens/provision/"
Loading