Prefix doesn't return a string, it returns an array. I think this gets
stringified in the error message, but it screws up the lookup. Try
hiera($role_value[0]).
On Friday, September 27, 2013 9:32:12 AM UTC-7, Tom Hanstra wrote:
>
> I'm having a real trouble getting hiera to work as expected.
>
> My current setup has a puppet master and an agent. On both I have the
> same /etc/hiera.yaml file linked into the /etc/puppet directory. I've also
> been able to confirm that hiera is seeing the right json files in
> /var/lib/hiera.
>
> What I'm seeing right now is that if I hard code a value (in my case a
> value called "role_puptest1"). In the class I'm working on, if I hardcode
> that value into the hiera lookup:
>
> $server_role = hiera('role_puptest1')
>
> then puppet agent runs just fine. However, if I build the value
> "role_puptest1" from other information, for instance like this:
>
> $role_value = prefix([$hostname],'role_')
> $server_role = hiera($role_value)
>
> I get this error when running the puppet agent:
>
> Error: Could not retrieve catalog from remote server: Error 400 on SERVER:
> Could not find data item role_puptest1 in any Hiera data file and no
> default supplied at
> /etc/puppet/modules/server/iptables2/manifests/init.pp:9 on node
> puptest1.library.nd.edu
>
> Based on the error, it is parsing the role_value properly (still has
> "role_puptest1"), but it is not finding the value in the file. At the same
> time, command line hiera on both my agent and my master find the file
> properly:
>
> puptest1 800$ hiera role_puptest1
> role_LOCKSS
>
> So, why is the generated value which comes up with the same string of data
> not finding the record in the hiera data file?
>
> I'm using hiera 1.2.1 and puppet 3.2.4 on RHEL 6.
>
> Thanks,
> Tom
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.