Could not find data item in any Hiera data file and no default supplied

asked 2015-07-03 02:24:27 -0600

minthu gravatar image

updated 2015-07-07 03:55:54 -0600

I have the following class and the common.yaml, when i compiled it's looking for default but not available. when Filer is not provided, i would like it to go to both. Where do i put default or undef in my code that skips searching for the Filer parameter?

      autofs::mount { '/mount1':
          mapfile     => '/etc/auto.puppetmount',
          map => hiera("${environment}::profile::${Filer}::mount1"),

          autofs::mount { '/mount2':
               mapfile     => '/etc/auto.puppetmount',
               map => hiera("${environment}::profile::${Filer}::mount2"),


         development::profile::Filer1::mount1:           ""
         development::profile::Filer2::mount1:           ""
         development::profile::mount1:                      ","
edit retag flag offensive close merge delete


Please intend your code. Write four spaces in front of each line of code. Leave one empty line above and below each line of code. This increases the readability of your code.

sinned gravatar imagesinned ( 2015-07-07 03:05:10 -0600 )edit

Debugging hiera: Put notifys in your code to check the variables contents of $Filer and $environment. Then use those values to query hiera via CLI using the debug flag: hiera -d -c /etc/puppet/hiera.yaml -a ::Filer=Filer2 ::environment=development Something like that. Post results.

sinned gravatar imagesinned ( 2015-07-07 03:10:06 -0600 )edit

indented :) btw, comment session is very limited. not sure how to put notifys or what u meant by it thou. # hiera -d -c /etc/puppetlabs/puppet/hiera.yaml -a development::profile::Filer1::mount1 [""] if i dont complete the whole hiera string, it shows nil

minthu gravatar imageminthu ( 2015-07-07 04:05:53 -0600 )edit

debug: after that, debug hiera. the syntax for the parameters is key=value (with equals sign). you have to give all parameters necessary to execute the hiera lookup, so Filer and environment, maybe more depending on your hiera.conf.

sinned gravatar imagesinned ( 2015-07-07 13:52:55 -0600 )edit