On Wednesday, August 22, 2012 9:22:04 PM UTC-5, Jarod Watkins wrote:
>
> Sorry, I should explained my issue:
>
> class apache (
> $apache = hiera_hash('apache'),
> $mpm = $apache['mpm'],
> )
>
> This code will produce the following error:
>
> Could not retrieve catalog from remote server: Error 400 on SERVER: apache
> is not an hash or array when accessing it with mpm
>
> If I do not try to set mpm inside the class definition but inside the
> manifest it will work:
>
> class apache (
> $apache = hiera_hash('apache'),
> ) {
>
> $mpm = $apache['mpm']
> notify { "Hiera is: ${mpm}": }
>
> Again am I seeing a bug or is this not how I should be doing things?
>
You should be using the plain hiera() function instead of hiera_hash().
The latter is for collecting values of the same key from multiple levels of
your environment, and returning the combined result as a hash (level =>
value, IIRC). You just want the value assigned to key 'apache'; that the
value happens to be a hash is irrelevant.
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/-/_mkKGzZ-4rsJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.