On Sunday, July 1, 2012 2:04:36 AM UTC-5, Peter wrote: > > Hi Puppet Users, > > For some bizzare reason I am unable to use hiera-puppet with a > parameterised class. > > The output is: > > ---------------------------- > root@hiera hieratest/manifests# puppet apply -e "include hieratest" > Error: undefined method `catalog' for #<Hash:0xb6c53d00> at line 1 on node > hiera.localdomain > Wrapped exception: > undefined method `catalog' for #<Hash:0xb6c53d00> > Error: undefined method `catalog' for #<Hash:0xb6c53d00> at line 1 on node > hiera.localdomain > ---------------------------- > > These are the versions that I am using (taken from the Puppetlabs > Debian/Devel): > > hiera (1.0.0-0.1rc3) > > hiera-puppet (1.0.0-0.1rc1-1-g3e68ff0) > > puppet-common (3.0.0-0.1rc3puppetlabs1) > > puppet (3.0.0-0.1rc3puppetlabs1) >
Puppet 3 has hiera built in. The above may be the correct stack, but you should verify -- it may be that one or both of the hiera pieces are for Puppet 2, not Puppet 3. > Relevant Files: > > *init.pp file* > > -------------------- > > root@hiera hieratest/manifests# cat init.pp > > class hieratest ( > > $bar = hiera("foo"), > > $zoo = hiera("service_default_loc") > > ) { > > notice ("Working ...") > > notice ("Bar == ${bar}") > > notice ("Module_user == ${zoo}") > > } > Although it's not clear that that is wrong, it's definitely a strange way of doing things in Puppet 3. Part of Puppet 3's integration with Hiera is to automatically look up class parameters by name, via hiera, when you declare classes using the 'include' function (or, I presume, the 'require' function). And you should embrace that usage, because it overcomes some serious limitations attending parametrized in Puppet 2. What you're doing duplicates that, sort of. I'm not sure whether that's the problem, but I suggest you start by arranging your data and/or your parameter names to be consistent with Puppet 3's expectations for automatic parameter lookup. Then remove the (mostly-)redundant default values from your class parameter definitions. That should be a better setup anyway, and if the problem persists at that point then at least you will have a simpler system to debug. John -- 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/-/mO9m8zSlAoYJ. 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.