Inventory/constraints: improve assertion messages

This commit is contained in:
Johannes Kirschbauer
2024-11-21 12:59:19 +01:00
committed by hsjobeki
parent cb0eb5f888
commit 55175e38cc

View File

@@ -24,8 +24,8 @@ in
"${moduleName}.${instanceName}.roles.${roleName}.min" = { "${moduleName}.${instanceName}.roles.${roleName}.min" = {
assertion = memberCount >= roleConstraints.min; assertion = memberCount >= roleConstraints.min;
message = '' message = ''
The ${moduleName} module requires at least ${builtins.toString roleConstraints.min} '${roleName}'s The ${moduleName} module requires at least ${builtins.toString roleConstraints.min} members of the '${roleName}' role
but found '${builtins.toString memberCount}' within instance '${instanceName}': but found '${builtins.toString memberCount}' members within instance '${instanceName}':
${lib.concatLines members} ${lib.concatLines members}
''; '';
@@ -36,8 +36,8 @@ in
"${moduleName}.${instanceName}.roles.${roleName}.max" = { "${moduleName}.${instanceName}.roles.${roleName}.max" = {
assertion = memberCount <= roleConstraints.max; assertion = memberCount <= roleConstraints.max;
message = '' message = ''
The ${moduleName} module allows at most for ${builtins.toString roleConstraints.max} '${roleName}'s The ${moduleName} module allows at most for ${builtins.toString roleConstraints.max} members of the '${roleName}' role
but found '${builtins.toString memberCount}' within instance '${instanceName}': but found '${builtins.toString memberCount}' members within instance '${instanceName}':
${lib.concatLines members} ${lib.concatLines members}
''; '';