Ask Your Question

hiera could not find item

asked 2014-03-21 14:53:41 -0500

Any one had this problem to find a attribute or know how to solve this? In my case I separated hiera files by osfamily when I execute

 # hiera packages_utils

return me


BUT if I execute

# hiera packages_utils osfamily=Debian

it's works


the facter osfamily works.

# facter osfamily

my hiera.yaml

  - yaml
  - "nodes/%{fqdn}"
  - "osfamily/%{osfamily}"
  - "osfamily/%{operatingsystem}"
  - defaults/users
  - defaults/hosts
  - "%{clientcert}"
  - "%{environment}"
  - global

# datadir is empty here, so hiera uses its defaults:
# - /var/lib/hiera on *nix
# - %CommonAppData%\PuppetLabs\hiera\var on ...
edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2014-03-21 23:53:15 -0500

updated 2014-03-22 02:14:06 -0500

Hi, Renan,

When you use the Hiera command-line tool without any "facts" provided (hiera packages_utils), nothing in your hierarchy that uses facts will match. In the hierarchy you have defined above, fqdn, osfamily, etc are null unless you explicitly provide them.

Without any facts provided, you're relying on one of these to exist and have package_utils defined:

  - defaults/users
  - defaults/hosts
  - global

Does that make sense?

edit flag offensive delete link more

answered 2014-03-22 13:07:53 -0500

That make sense , thank you josh but ok, can you help with that, why when I try to use puppet agent -t in my node I receive this.

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not find data item  in any Hiera data file and no default supplied at /etc/puppet/modules/ananke-base-utils/manifests/init.pp:42 on node tm-ld168-senac
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

this is the part of my code that I am having trouble:

 38 class ananke-base-utils {
 40 # variables from hiera ...
edit flag offensive delete link more



You probably want to use `hiera('conf_ntp')` here. You have to provide the keyname that hiera should look up as a string. The error indicates that you are trying to ...(more)

Stefan gravatar imageStefan ( 2014-03-22 14:49:12 -0500 )edit

thank you very much, problem solved :D

Renan Vicente gravatar imageRenan Vicente ( 2014-03-22 15:07:33 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-03-21 14:53:41 -0500

Seen: 3,599 times

Last updated: Mar 22 '14