FAQ
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 puppet-users+unsubscribe@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Ellison Marks at Sep 27, 2013 at 5:35 pm
    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 puppet-users+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-users@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-users.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Tom Hanstra at Sep 30, 2013 at 12:53 pm
    Spot on! Thanks for pointing this out.

    Tom
    On Friday, September 27, 2013 1:35:42 PM UTC-4, Ellison Marks wrote:

    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 puppet-users+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-users@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-users.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Peter Meier at Sep 28, 2013 at 11:16 am

    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.
    Note: if you want to go with plain master/agent setup, there is no
    need to setup hiera on the client. As the agent gets a compiled
    catalog from the master that can be seen as kind of static, at least
    all the hiera lookups are done when the agent receives the catalog.

    ~pete



    --
    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 puppet-users+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-users@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-users.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Tom Hanstra at Sep 30, 2013 at 10:01 pm
    Pete: Thanks for pointing this out as well. It explains some things that
    were confusing me about how I was using hiera. I appreciate the
    information.

    Tom
    On Saturday, September 28, 2013 7:16:00 AM UTC-4, Peter Meier wrote:

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1
    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.
    Note: if you want to go with plain master/agent setup, there is no
    need to setup hiera on the client. As the agent gets a compiled
    catalog from the master that can be seen as kind of static, at least
    all the hiera lookups are done when the agent receives the catalog.

    ~pete

    --
    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 puppet-users+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-users@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-users.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedSep 27, '13 at 4:32p
activeSep 30, '13 at 10:01p
posts5
users3
websitepuppetlabs.com

People

Translate

site design / logo © 2022 Grokbase