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?

Jarod

On Wednesday, August 22, 2012 9:39:46 PM UTC-4, Jarod Watkins wrote:
>
> Hello,
> I have the following in common.yaml:
>
> apache:
>   mpm: worker
>
> If I do a "manual" lookup with the hiera command I get the proper result:
>
> hiera --config /etc/puppet/hiera.yaml apache
> {"mpm"=>"worker"}
>
> However, when trying to get the apache hash in a manifest, it appears to 
> be returned as a flattened string. I am using this notify statement in the 
> manifest:
>
> $apache = hiera('apache')
> notify { "Hiera is: ${apache}": }
>
> And I get this returned:
>
> Notify[Hiera is: mpmworker]
>
> The same thing is returned when I used hiera_hash. Interestingly enough, 
> when I used hiera_array I get this error message:
>
> Hiera type mismatch: expected Array and got Hash
>
> Am I seeing some sort of bug or am I doing something wrong?
>
> Puppet version: 2.7.18
> Hiera version: 1.0.0-0.1rc4
> Puppet-Hiera version: 1.0.0-0.1rc3
>
> Thanks,
> Jarod
>

-- 
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/-/ZTOWuA1Q69sJ.
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