inventory: fix path filter wrong length

This commit is contained in:
Johannes Kirschbauer
2025-10-23 18:26:22 +02:00
parent 50aa7eb0cf
commit ae5efd9e2f

View File

@@ -40,12 +40,11 @@ let
name: name:
let let
v = set.${name}; v = set.${name};
loc = path ++ [ name ];
in in
if pred path v then if pred loc v then
[ [
(lib.nameValuePair name ( (lib.nameValuePair name (if lib.isAttrs v then filterAttrsRecursive' loc pred v else v))
if lib.isAttrs v then filterAttrsRecursive' (path ++ [ name ]) pred v else v
))
] ]
else else
[ ] [ ]
@@ -56,8 +55,7 @@ let
# Remove extraModules from serialization, # Remove extraModules from serialization,
# identified by: prefix + pathLength + name # identified by: prefix + pathLength + name
# inventory.instances.*.roles.*.extraModules # inventory.instances.*.roles.*.extraModules
path: _value: path: _value: !(lib.length path == 5 && ((lib.last path)) == "extraModules")
lib.length path <= 5 || lib.head path != "instances" || (lib.elemAt path 5) != "extraModules"
) exposedInventory; ) exposedInventory;
in in
{ {