krebs: DRY up shorts of the networking.extraHosts generator

This commit is contained in:
tv 2016-02-06 15:57:43 +01:00
parent df89fb7e91
commit a1f7f5e510

View File

@ -103,10 +103,8 @@ let
aliases = longs ++ shorts; aliases = longs ++ shorts;
providers = dns.split-by-provider net.aliases cfg.dns.providers; providers = dns.split-by-provider net.aliases cfg.dns.providers;
longs = providers.hosts; longs = providers.hosts;
shorts = shorts = let s = ".${cfg.search-domain}"; in
map (removeSuffix ".${cfg.search-domain}") map (removeSuffix s) (filter (hasSuffix s) longs);
(filter (hasSuffix ".${cfg.search-domain}")
longs);
in in
map (addr: "${addr} ${toString aliases}") net.addrs map (addr: "${addr} ${toString aliases}") net.addrs
) (filterAttrs (name: host: host.aliases != []) host.nets) ) (filterAttrs (name: host: host.aliases != []) host.nets)