On Apr 27, 8:12 am, Andre Nathan <andre...@gmail.com> wrote: > Hello John > > On Friday, April 27, 2012 9:58:09 AM UTC-3, jcbollinger wrote: > > > I know it's not what you want to hear, but Hiera is your best bet. I > > don't think the code base size is relevant, because I don't think the > > time and effort to implement an Hiera-based class data source is > > likely to differ much from what parameterizing all the same classes > > would require. Or to put it a different way, solving your problem via > > class parameterization would require *at least* as much shakeup of > > your code base as would implementing an hiera-based solution. > > Well, the thing is that we're in the middle of a transition process that is > moving from "everything is a global variable in the node" to parametrized > classes, and while they are not perfect, I found that our new code is much > saner and easier to debug when using them. > > So the question is, are parametrized classes now considered "deprecated"?
No, they are not deprecated. "Raw" would be a better description: the implementation of parameterized classes in 2.6 (where they were introduced) and 2.7 has always had problems, especially including the one you asked about. > I > remember reading somewhere that improvements were being made for Puppet > 2.8... I have it on good authority that parameterized classes will be greatly improved for Puppet's next major release, "Telly". I have been told that among other things, they will be integrated with Hiera in a way that sounds very useful. I am uncertain, however, whether the use case you seem to be looking for will be supported. That is, in Telly you should be able to include a parameterized class as many times as you want if you rely only on parameter defaults (which themselves will be improved for Telly), but I don't know whether you will be able to do the same if you specify custom parameter values. > While I can see the advantages of Hiera, it seems to me that it's > another instance of the global variable problem if it's used to load values > inside some class, and I'd rather not lose the benefit of being able to > check a class "signature" to see immediately what variables it needs, and > having the code fail if any is not provided. I think you will like Telly's improvements in this area, at least if they work as was explained to me. Until then, however, you simply cannot use parameterized classes in the way you are trying to do. It does not work. Use external data from Hiera instead of class parameters, with Hiera keys corresponding to the class and parameter names that you otherwise would implement. That's a sane and manageable design in its own right, and it will also position you well to transition to Telly when it come out. Document your classes with plain comments (which you should do anyway), and you have most of what you were looking for, except Puppet automatically failing if a class parameter is omitted. John -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.