On Tuesday, December 18, 2012 12:43:44 PM UTC-6, Philip Brown wrote:
>
>
>
> On Tuesday, December 18, 2012 10:28:35 AM UTC-8, Ellison Marks wrote:
>>
>> No, it's additive. It will get all the class names from all hierarchy 
>> levels that a host maps to. 
>
>
> Waaait a minute. Now I'm really confused about hiera :(
>
> I thought hiera was usually replacing, not additive.
>
> Or is it that single-value hiera lookups, are replacing, but array lookups 
> are additive?
>
> holy inconsistencies, batman!
> We almost implemented something wrong then. We were planning on using 
> hiera to pull a default array of NTP servers, but then override the default 
> list, if at a sattelite office.  But you're telling me that since it's an 
> array, it will add, not override? !
>


No.  The hierra_array() and hiera_hash() functions are always additive.  
The the plain hiera() function is never additive.

That is completely unrelated to the type of data being retrieved.  The 
plain hiera() function will return an array or hash if that is the type of 
the item matching the specified key.

By the same token, the elements of the array returned by hiera_array() will 
be of whatever type appears in your data file for the given key at the 
corresponding hierarchy level.  In particular, if you have lists of classes 
at each level, then hiera_array() will retrieve it all as an array of 
arrays, which you would need to flatten.  PuppetLabs' "stdlib" add-on 
module contains a suitable flatten() function, or you could write your own.


John

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/uuKRdINJuaoJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to