I'm running into the same issue on Ubuntu 10.04, hiera 0.3.0, puppet 2.7.18, ruby187.
Hiera can lookup values, but only if there is no variable interpolation in /etc/puppet/hiera.yaml. :hierarchy: - '%{operatingsystem}' - common will give this error: err: Could not retrieve catalog from remote server: Error 400 on SERVER: can't convert nil into String while :hierarchy: - common works without any errors. I also ran into this trying to setup hiera to use different hieradata directories based on environment. :yaml: - '/etc/puppet/environments/production/hieradata' works properly. :yaml: - 'etc/puppet/environments/%{environment}/hieradata' will give the same error: err: Could not retrieve catalog from remote server: Error 400 on SERVER: can't convert nil into String Thanks, Evan On Friday, August 17, 2012 6:52:38 AM UTC-4, linuxbsdfreak wrote: > > Hi, > > I figured that out and did the changes to verify. However it doesn't parse > the hierarchy to override the values. I did a quick test to only use the > operatingsystem fact in hierarchy. It doesnt pickup the value from it > also. Even though the machine is CentOS. I dont know if hiera 0.3.0 works > with ruby1.9.3 > > Regards, > Kevin > > > On Friday, August 17, 2012 12:13:37 PM UTC+2, denmat wrote: >> >> Sorry, your hiera config points to: >> -'%{operatingsystem}' >> - '%{platform}/%{location}/%{role} >> - common role >> >> But the facts you have are: >> company_role >> company_platform >> company_location >> >> So unless you have facts platform, location, and role defined they aren't >> going to match up. It's like the facts you've used below: >> >> hiera -c /etc/puppet/hiera.yaml hsflowd_port platform=production >> location=frankfurt role=dev_tst >> >> So role = dev_tst does not equal custom_role = dev_tst >> >> -- you get what I mean? >> >> Something like this might work: >> -'%{operatingsystem}' >> - %{custom_platform}/%{custom_location}/%{custom_role} >> - '%{platform}/%{location}/%{role}' >> >> See if that works, >> Den >> On 17 Aug 2012 19:31, "linuxbsdfreak" <linuxb...@gmail.com> wrote: >> >>> Just for info i am running ruby-1.9.3p194. >>> >>> >>> On Friday, August 17, 2012 9:28:13 AM UTC+2, linuxbsdfreak wrote: >>>> >>>> Hi, >>>> >>>> The default value works when i set the value in common.yaml. Strange >>>> part is why isnt hiera find the value in the hierarchy, since i want to >>>> override the default value according to a facter fact. >>>> >>>> Regards, >>>> Kevin >>>> >>>> On Friday, August 17, 2012 2:57:03 AM UTC+2, denmat wrote: >>>>> >>>>> Hi, >>>>> >>>>> Can't see anything that stands out in the quick glance, but here's how >>>>> you can dig further: >>>>> >>>>> Use --debug on your puppet run and you'll get an output of what hiera >>>>> is going through. Second, use notify to print out the variables you are >>>>> trying to access, making sure they match with what hiera is looking for >>>>> and >>>>> what you expect. You can also try setting the default for the >>>>> hsflowd_port >>>>> and see if that solves your problems or there are others (not saying you >>>>> should only use the default, just to further your own investigations). >>>>> >>>>> $hsflowd_port = hiera('hsflowd_port', '8080'), >>>>> >>>>> >>>>> >>>>> HTH, >>>>> Den >>>>> >>>>> On 17/08/2012, at 1:38, linuxbsdfreak <linuxb...@gmail.com> wrote: >>>>> >>>>> Typo error location=frankfurt is actually location=london. >>>>> >>>>> On Thursday, August 16, 2012 5:25:17 PM UTC+2, linuxbsdfreak wrote: >>>>>> >>>>>> Hi All, >>>>>> >>>>>> I am using hiera for storing configuration values. I have setup >>>>>> puppet to use facter following the article from >>>>>> >>>>>> http://nuknad.com/2011/02/11/**s**elf-classifying-puppet-nodes/<http://nuknad.com/2011/02/11/self-classifying-puppet-nodes/> >>>>>> >>>>>> I have custom facts >>>>>> >>>>>> company_role >>>>>> company_platform >>>>>> company_location >>>>>> >>>>>> I have defined the following in hiera.yaml >>>>>> >>>>>> --- >>>>>> :backends: >>>>>> - yaml >>>>>> >>>>>> :logger: console >>>>>> >>>>>> :hierarchy: >>>>>> - '%{operatingsystem}' >>>>>> - '%{platform}/%{location}/%{**rol**e}' >>>>>> - common >>>>>> >>>>>> :yaml: >>>>>> :datadir: '/etc/puppet/hieradata' >>>>>> >>>>>> >>>>>> and i create the directories /etc/puppet/hieradata/**producti** >>>>>> on/london/dev_tst.yaml >>>>>> >>>>>> I have something like this in the above file >>>>>> >>>>>> --- >>>>>> >>>>>> hsflowd_port: 8080 >>>>>> >>>>>> company_role: dev_tst >>>>>> company_platform: production >>>>>> company_location: london >>>>>> >>>>>> Given a system with the above facts connecting to puppetmaster. When >>>>>> i run the client i get the following error >>>>>> >>>>>> Err: Could not retrieve catalog from remote server: Error 400 on >>>>>> SERVER: Could not find data item hsflowd_port in any Hiera data file and >>>>>> no >>>>>> default supplied at /etc/puppet/modules/hsflowd/**ma** >>>>>> nifests/config.pp. >>>>>> >>>>>> >>>>>> For some reason its not getting the value. However when i do the >>>>>> following from the command line >>>>>> >>>>>> hiera -c /etc/puppet/hiera.yaml hsflowd_port platform=production >>>>>> location=frankfurt role=dev_tst >>>>>> >>>>>> I get the value. >>>>>> >>>>>> Following is my manifest: >>>>>> >>>>>> class hsflowd::config( >>>>>> $hsflowd_user = hiera('hsflowd_user'), >>>>>> $hsflowd_group = hiera('hsflowd_group'), >>>>>> $hsflowd_config_dir = hiera('hsflowd_config_dir'), >>>>>> $hsflowd_port = hiera('hsflowd_port'), >>>>>> ) >>>>>> >>>>>> { >>>>>> >>>>>> file { >>>>>> "${hsflowd_config_dir}/**hsflowd**.conf": >>>>>> ensure => present, >>>>>> content => template("${module_name}/**hsflo** >>>>>> wd.conf.erb"), >>>>>> owner => $hsflowd_user, >>>>>> group => $hsflowd_group, >>>>>> mode => '0644'; >>>>>> } >>>>>> >>>>>> Is something wrong that i am doing? >>>>>> >>>>>> Regards, >>>>>> Kevin >>>>>> >>>>>> >>>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "Puppet Users" group. >>>>> To view this discussion on the web visit https://groups.google.com/d/* >>>>> *msg/puppet-users/-/**L2PKd1u1QAgJ<https://groups.google.com/d/msg/puppet-users/-/L2PKd1u1QAgJ> >>>>> . >>>>> To post to this group, send email to puppet...@googlegroups.com. >>>>> To unsubscribe from this group, send email to >>>>> puppet-users...@googlegroups.**com. >>>>> For more options, visit this group at http://groups.google.com/** >>>>> group/puppet-users?hl=en<http://groups.google.com/group/puppet-users?hl=en> >>>>> . >>>>> >>>>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Puppet Users" group. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msg/puppet-users/-/3rPfzeEvIMUJ. >>> To post to this group, send email to puppet...@googlegroups.com. >>> To unsubscribe from this group, send email to >>> puppet-users...@googlegroups.com. >>> For more options, visit this group at >>> http://groups.google.com/group/puppet-users?hl=en. >>> >> -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/IUxIYOBW5E8J. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.