On Wed, Dec 15, 2010 at 12:38 AM, Dan Bode <[email protected]> wrote:
> > > On Tue, Dec 14, 2010 at 10:35 AM, Paul Berry <[email protected]> wrote: > >> On Mon, Dec 13, 2010 at 4:42 PM, Luke Kanies <[email protected]> wrote: >> >>> If your goal is to evaluate a parameterized class, it's, um, apparently >>> pretty annoyingly complicated. At least, if the parameterized class has a >>> parent class it is. Look at the 'ensure_in_catalog' method in >>> lib/puppet/resource/type.rb in the current master branch for an example of >>> how it's done when there aren't parameters. >>> >>> > I tried to use this code to to create a param class from the ENC (in > parser/compiler) after patching ensure_in_catalog to accept params. > > resource = Puppet::Resource::Type.new(:hostclass, name) > resource.ensure_in_catalog(topscope, params) > > This works perfectly except for resources in the parent class. > > ensure_in_catalog calls instantiate_resource(scope, resource) which expects > a parent class to be set, but it is not the responsibility of my code to set > the parent class, it should be set when the autoloaded loads the class. > > What am I missing? Am I supposed to be passing the scope where the class is > defined and not the scope where it is declared? > > > >> Paul - would it be possible to extend that method to accept parameters, >>> and then promote it as an API method for use in things like functions? >>> >> >> Just to supply some missing context here: I believe Dan is working on a >> patch for ticket #5045 (External node classifiers should be able to specify >> parameters for parameterized classes). From a discussion with Nigel >> yesterday, it sounds like we want to get this ticket into 2.6.x. >> > > that would be awesome. I was talking to a customer about that today. > I absolutely want this in 2.6.x. > > >> So, to answer your question, Luke, yes, it would certainly be possible to >> extend ensure_in_catalog to take parameters, >> > > I have implemented this in the patch that I am working on. > > >> and I think that's the right way to address ticket #5045. I'm not sure >> it's necessary to promote it to an API, though. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Puppet Developers" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]<puppet-dev%[email protected]> >> . >> For more options, visit this group at >> http://groups.google.com/group/puppet-dev?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Developers" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<puppet-dev%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/puppet-dev?hl=en. > -- Nigel Kersten - Puppet Labs - http://www.puppetlabs.com -- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.
