We're using puppet 3.8 (unfortunately can't move to puppet 4 yet)
I've got a hash in hiera that looks something like this:
hash_data:
item1:
field1: 'some data'
array_data:
- data1
- data2
item2:
field1: 'other data'
array_data:
- data3
- data4
I've put together a module with code something like:
class processor {
$data = hiera_hash('hash_data', {})
create_resources(processor::hash_entry, $data)
}
define processor::hash_entry ($field1, $array_data) {
# .. do_something ..
# process array items
processor::process_array { ${array_data} :
datavar = 'somevalue'
}
}
define processor::process_array($element, $datavar) {
# do something
}
this works fine as long at the array_data fields in the hash all contain unique fields. However, if I need to put non-unique data something like:
hash_data:
item1:
field1: 'some data'
array_data:
- data1
- data2
item2:
field1: 'other data'
array_data:
- data3
- data2 ( **non-unique value **)
then we hit a duplicate resource. Can anyone suggest how I could process that hash if I wanted to be able to handle the items in array_data as unique items?
Thanks
↧