summary refs log tree commit diff
path: root/nixos/lib/testing-python.nix
diff options
context:
space:
mode:
authorDavid Arnold <dgx.arnold@gmail.com>2021-07-27 19:38:10 -0500
committerDavid Arnold <dgx.arnold@gmail.com>2021-07-28 15:37:57 -0500
commitdc060ff8b2abef52a75fede1b9ea6d35e280931f (patch)
tree39599fec6336a97bf924b1dd66ec55b5bfe5f82e /nixos/lib/testing-python.nix
parent0efb458bc1d1c5d4f36e55ae3c513d5dec615d46 (diff)
downloadnixpkgs-dc060ff8b2abef52a75fede1b9ea6d35e280931f.tar
nixpkgs-dc060ff8b2abef52a75fede1b9ea6d35e280931f.tar.gz
nixpkgs-dc060ff8b2abef52a75fede1b9ea6d35e280931f.tar.bz2
nixpkgs-dc060ff8b2abef52a75fede1b9ea6d35e280931f.tar.lz
nixpkgs-dc060ff8b2abef52a75fede1b9ea6d35e280931f.tar.xz
nixpkgs-dc060ff8b2abef52a75fede1b9ea6d35e280931f.tar.zst
nixpkgs-dc060ff8b2abef52a75fede1b9ea6d35e280931f.zip
nixos/testing: fix invalid node names detection
the use of python further restricts possible RFC1035 host labels since
dash is not allowed for use in python identifiers.

The previous implementation of this check was flawed, since it did not
check the `hostName` value that is actually used to construe the
identifier, but the node name, which can be anything, e.g. just `machine`.

The previous implementation, by further restricting RFC1035 labels, only
for the sake of testing seems to be an unacceptable restriction and should
be addressed separately.
Diffstat (limited to 'nixos/lib/testing-python.nix')
-rw-r--r--nixos/lib/testing-python.nix9
1 files changed, 7 insertions, 2 deletions
diff --git a/nixos/lib/testing-python.nix b/nixos/lib/testing-python.nix
index 768f1dc2a17..c703484666d 100644
--- a/nixos/lib/testing-python.nix
+++ b/nixos/lib/testing-python.nix
@@ -130,9 +130,12 @@ rec {
 
       nodeHostNames = map (c: c.config.system.name) (lib.attrValues nodes);
 
+      # TODO: This is an implementation error and needs fixing
+      # the testing famework cannot legitimately restrict hostnames further
+      # beyond RFC1035
       invalidNodeNames = lib.filter
         (node: builtins.match "^[A-z_]([A-z0-9_]+)?$" node == null)
-        (builtins.attrNames nodes);
+        nodeHostNames;
 
       testScript' =
         # Call the test script with the computed nodes.
@@ -146,7 +149,9 @@ rec {
         Cannot create machines out of (${lib.concatStringsSep ", " invalidNodeNames})!
         All machines are referenced as python variables in the testing framework which will break the
         script when special characters are used.
-        Please stick to alphanumeric chars and underscores as separation.
+
+        This is an IMPLEMENTATION ERROR and needs to be fixed. Meanwhile,
+        please stick to alphanumeric chars and underscores as separation.
       ''
     else lib.warnIf skipLint "Linting is disabled" (runCommand testDriverName
       {