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/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}/%{role}'' - common :yaml: :datadir: ''/etc/puppet/hieradata'' and i create the directories /etc/puppet/hieradata/production/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/manifests/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}/hsflowd.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/-/Ovmv8ImAHuoJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
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/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}/%{role}'' > - common > > :yaml: > :datadir: ''/etc/puppet/hieradata'' > > > and i create the directories > /etc/puppet/hieradata/production/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/manifests/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}/hsflowd.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. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
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 <linuxbsdfreak@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/**self-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}/%{**role}'' > - common > > :yaml: > :datadir: ''/etc/puppet/hieradata'' > > > and i create the directories /etc/puppet/hieradata/** > production/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/**manifests/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}/**hsflowd.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. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@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 post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
linuxbsdfreak
2012-Aug-17 07:28 UTC
Re: [Puppet Users] Re: Hiera unable to retrieve the value
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 <javascript:>> > 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/**self-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}/%{**role}'' >> - common >> >> :yaml: >> :datadir: ''/etc/puppet/hieradata'' >> >> >> and i create the directories /etc/puppet/hieradata/** >> production/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/**manifests/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}/**hsflowd.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. > To post to this group, send email to puppet...@googlegroups.com<javascript:> > . > To unsubscribe from this group, send email to > puppet-users...@googlegroups.com <javascript:>. > 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/-/OXeVLSL5_iIJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
linuxbsdfreak
2012-Aug-17 09:31 UTC
Re: [Puppet Users] Re: Hiera unable to retrieve the value
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/**self-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}/%{**role}'' >>> - common >>> >>> :yaml: >>> :datadir: ''/etc/puppet/hieradata'' >>> >>> >>> and i create the directories /etc/puppet/hieradata/** >>> production/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/**manifests/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}/** >>> hsflowd.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. >> 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/-/3rPfzeEvIMUJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
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" <linuxbsdfreak@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-users@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscribe@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 post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
linuxbsdfreak
2012-Aug-17 10:52 UTC
Re: [Puppet Users] Re: Hiera unable to retrieve the value
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 <javascript:>> > 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<javascript:> >> . >> To unsubscribe from this group, send email to >> puppet-users...@googlegroups.com <javascript:>. >> 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/-/2rb9UPd-7eEJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Evan Stachowiak
2012-Aug-22 19:44 UTC
Re: [Puppet Users] Re: Hiera unable to retrieve the value
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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Evan Stachowiak
2012-Aug-23 15:21 UTC
Re: [Puppet Users] Re: Hiera unable to retrieve the value
I managed to sort this out by checking out the latest hiera-puppet and upgrading the hiera & hiera-puppet gems to 1.0.1.0rc4 & 1.01.0rc3 respectively. After updating hiera-puppet, be sure to restart the puppet master. If you do not update hiera & hiera-puppet gems, you may encounter the error: “no such file to load — hiera_puppet”. This issue is documented in the following bug report: http://projects.puppetlabs.com/issues/15570 To update your hiera gems run: gem install hiera hiera-puppet --pre (pre will install the release candidates instead of 0.0.3) -Evan On Wednesday, August 22, 2012 3:44:21 PM UTC-4, Evan Stachowiak wrote:> > 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/-/vw0OWL38nBUJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.