Merge pull request #89748 from heinic/krb5-lists

This commit is contained in:
Jörg Thalheim 2020-09-03 07:31:22 +01:00 committed by GitHub
commit 02a2649220
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 18 deletions

View file

@ -41,31 +41,30 @@ let
value)
else value;
mkIndent = depth: concatStrings (builtins.genList (_: " ") (2 * depth));
indent = " ";
mkRelation = name: value: "${name} = ${mkVal { inherit value; }}";
mkRelation = name: value:
if (isList value) then
concatMapStringsSep "\n" (mkRelation name) value
else "${name} = ${mkVal value}";
mkVal = { value, depth ? 0 }:
mkVal = value:
if (value == true) then "true"
else if (value == false) then "false"
else if (isInt value) then (toString value)
else if (isList value) then
concatMapStringsSep " " mkVal { inherit value depth; }
else if (isAttrs value) then
(concatStringsSep "\n${mkIndent (depth + 1)}"
([ "{" ] ++ (mapAttrsToList
(attrName: attrValue: let
mappedAttrValue = mkVal {
value = attrValue;
depth = depth + 1;
};
in "${attrName} = ${mappedAttrValue}")
value))) + "\n${mkIndent depth}}"
let configLines = concatLists
(map (splitString "\n")
(mapAttrsToList mkRelation value));
in
(concatStringsSep "\n${indent}"
([ "{" ] ++ configLines))
+ "\n}"
else value;
mkMappedAttrsOrString = value: concatMapStringsSep "\n"
(line: if builtins.stringLength line > 0
then "${mkIndent 1}${line}"
then "${indent}${line}"
else line)
(splitString "\n"
(if isAttrs value then
@ -114,7 +113,10 @@ in {
{
"ATHENA.MIT.EDU" = {
admin_server = "athena.mit.edu";
kdc = "athena.mit.edu";
kdc = [
"athena01.mit.edu"
"athena02.mit.edu"
];
};
};
'';

View file

@ -18,7 +18,10 @@ import ../make-test-python.nix ({ pkgs, ...} : {
realms = {
"ATHENA.MIT.EDU" = {
admin_server = "athena.mit.edu";
kdc = "athena.mit.edu";
kdc = [
"athena01.mit.edu"
"athena02.mit.edu"
];
};
};
domain_realm = {
@ -65,7 +68,8 @@ import ../make-test-python.nix ({ pkgs, ...} : {
[realms]
ATHENA.MIT.EDU = {
admin_server = athena.mit.edu
kdc = athena.mit.edu
kdc = athena01.mit.edu
kdc = athena02.mit.edu
}
[domain_realm]