hiera variable problem

50 views
Skip to first unread message

Christian Charpentier

unread,
Aug 7, 2014, 7:34:07 AM8/7/14
to puppet...@googlegroups.com
Hi,

I've been using hiera for several weeks now and all was working fine til few days ago when i started to get that kind of message:
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not find data item nom in any Hiera data file and no default supplied on node d0puppetclient.victor-buck.com
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

So i tried to make a very simple test to check if the problem came from my last code changes and i'm still getting this message. I can't get hiera variable anymore.
Below the test i made:

hiera.yaml:
---
:backends:
  - yaml

:yaml:
  :datadir: /etc/puppet/hieradata

:hierarchy:
  - common


site.pp:
# /etc/puppet/manifests/site.pp

case $operatingsystem {
  'Solaris': { include role::solaris }
  'RedHat', 'CentOS': { include redhat::roles::common }
  /^(Debian|Ubuntu)$/: { include role::debian }
#  default: { include role::generic }
}

case $hostname {
  /^d0puppetclient/: { include test }
}


test.pp:
class test{

  $nom = hiera('nom')

file {"/root/test.txt":
    ensure   => file,
    source   => "/etc/puppet/test.txt.erb",
  }

}


test.txt.erb:
<%= nom %>

Any idea about to fix this?I thought this could be an file access right issue, so i tried to grante access on some files (755) and it's not working...
Thanks to those who 'll take time to read me and give me an answer :)

Christian

José Luis Ledesma

unread,
Aug 7, 2014, 9:23:01 AM8/7/14
to puppet...@googlegroups.com

Hi,

What's the content of /etc/puppet/hieradata/common.yaml ?

Does the hiera command line works?
Something like:
$ hiera nom

Regards,

--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/41e41e5f-7d26-46c4-9fe4-861b146c8f4f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Christian Charpentier

unread,
Aug 7, 2014, 11:07:59 AM8/7/14
to puppet...@googlegroups.com
No, the command to get the hiera variable value (hiera nom) doesn't work.

The common.yaml file contents:

---
apache_packages_list:
 - apr-1.4.8
 - apr-devel-1.4.8
 - apr-util-1.5.2
 - apr-util-devel-1.5.2
 - distcache-1.4.5
 - distcache-devel-1.4.5
 - httpd-2.4.6
 - httpd-tools-2.4.6 
 - mod_ssl-2.4.6
 

classes: []

hiera_ressources_path: "/etc/puppet/hieradata"

nom: test

Regards,

Christopher Wood

unread,
Aug 7, 2014, 11:32:35 AM8/7/14
to puppet...@googlegroups.com
Run your puppetmaster in debug mode to see what's happening in detail. If that doesn't give you any hints, strace the process. Somewhere in one of those you will see what's going on.

su - puppet
puppet master --config /etc/puppet/puppet.conf --debug --no-daemonize 2>&1 | tee /var/tmp/pm1.log
strace puppet master --config /etc/puppet/puppet.conf --debug --no-daemonize 2>&1 | tee /var/tmp/pm2.log
> --
> 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 [1]puppet-users...@googlegroups.com.
> To view this discussion on the web visit
> [2]https://groups.google.com/d/msgid/puppet-users/41e41e5f-7d26-46c4-9fe4-861b146c8f4f%40googlegroups.com.
> For more options, visit [3]https://groups.google.com/d/optout.
>
> References
>
> Visible links
> 1. mailto:puppet-users...@googlegroups.com
> 2. https://groups.google.com/d/msgid/puppet-users/41e41e5f-7d26-46c4-9fe4-861b146c8f4f%40googlegroups.com?utm_medium=email&utm_source=footer
> 3. https://groups.google.com/d/optout
Reply all
Reply to author
Forward
0 new messages