Skip to content

Instantly share code, notes, and snippets.

@oranenj
Last active April 7, 2017 18:24
Show Gist options
  • Save oranenj/d92a40d6d2e1386d47f3f4d8427a5ab0 to your computer and use it in GitHub Desktop.
Save oranenj/d92a40d6d2e1386d47f3f4d8427a5ab0 to your computer and use it in GitHub Desktop.
#hiera.yaml
---
version: 5
defaults:
datadir: data
data_hash: yaml_data
hierarchy:
- name: test 1
path: test1.yaml
- name: test 2
path: test2.yaml
#test1.yaml
---
classes:
- test1bar
- test1foo
- test1quuz
- --test2bar
#test2.yaml
classes:
- 'test2bar'
- 'test2foo'
- 'test2quuz'
- '--test1bar'
$ puppet lookup --hiera_config $PWD/hiera.yaml classes --merge deep --knock-out-prefix "--" --merge-hash-arrays --explain
Searching for "classes"
Global Data Provider (hiera configuration version 5)
Using configuration "/home/oranenj/testcase/hiera.yaml"
Merge strategy deep
Options: {
"sort_merge_arrays" => false,
"merge_hash_arrays" => true,
"knockout_prefix" => "--"
}
Hierarchy entry "test 1"
Path "/home/oranenj/testcase/data/test1.yaml"
Original path: "test1.yaml"
Found key: "classes" value: [
"test1bar",
"test1foo",
"test1quuz"
<!------------------- No --test2bar?
]
Hierarchy entry "test 2"
Path "/home/oranenj/testcase/data/test2.yaml"
Original path: "test2.yaml"
Found key: "classes" value: [
"test2bar",
"test2foo",
"test2quuz",
"--test1bar"
]
Merged result: [
"test2foo",
"test2quuz",
<!---------------------- No test2bar ???
"--test1bar", <!---------------------- but why is this here?
"test1bar",
"test1foo",
"test1quuz"
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment