diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-11-06 22:56:10 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-11-06 23:28:45 +0100 |
commit | 4bc6cdc1967ab881af3807025dddb84418dfa7e4 (patch) | |
tree | b8f269d291a56d396d4d829df79647a6cc9c14d0 /functions | |
parent | Allow for lists in unit files. (diff) | |
download | networking-4bc6cdc1967ab881af3807025dddb84418dfa7e4.tar.gz networking-4bc6cdc1967ab881af3807025dddb84418dfa7e4.tar.xz |
Fix repack function.
Diffstat (limited to 'functions')
-rw-r--r-- | functions/repack.pp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/functions/repack.pp b/functions/repack.pp index 396354c..a4b7815 100644 --- a/functions/repack.pp +++ b/functions/repack.pp @@ -1,7 +1,9 @@ # Normalizes a hash or a list of hashes to a list of hashes -function networking::repack(Variant[Hash, Array[Hash]] $data) >> Array[Hash] { - $data ? { - Hash => [$data], - _ => $data, - } +function networking::repack(Hash[String,Variant[Hash, Array[Hash]]] $data) >> Hash[String, Array[Hash]] { + $data.map |$key, $body| { + [$key, $body ? { + Hash => [$body], + default => $body, + }] + }.convert_to(Hash) } |