On Oct 3, 2012, at 4:50 PM, Dan Bode <[email protected]> wrote: > > > On Wed, Oct 3, 2012 at 4:23 PM, Luke Kanies <[email protected]> wrote: > On Oct 3, 2012, at 3:53 PM, Dan Bode <[email protected]> wrote: > > > Hi Puppet devs, > > > > I am trying to use a parent provider from another module. > > > > I put the following code in the provider that wants to inherit from the > > parent: > > > > Puppet::Type.type(:ini_setting)#.providers > > > > Puppet::Type.type(:keystone_config).provide( > > :ini_setting, > > :parent => Puppet::Type::Ini_setting::ProviderRuby > > > > The important thing to note here is that I am calling Puppet::Type.type > > from topscope to ensure that the type whose provider I want to inherit from > > is properly loaded before I try to use the parent's constant when I create > > my provider. (it looks like this also gets the providers for that type > > loaded) > > > > Is there a better way to do this? > > You should be able to just do: > > Puppet::Type.type(:keystone_config).provide(:ini_setting, :parent => > Puppet::Type::Ini_setting.provider_class(:ruby)) > > that returns the following error: > > uninitialized constant Puppet::Type::Ini_setting at > /tmp/vagrant-puppet/modules-0/keystone/manifests/init.pp:59 on node > keystone-20121003101349307130 > > it looks like the following code works perfectly: > > Puppet::Type.type(:keystone_config).provide( > :ini_setting, > :parent => Puppet::Type.type(:ini_setting).provider(:ruby) > > thanks for leading me in the right direction.
Ah, yeah, that's actually what I meant to type. :) -- Luke Kanies | http://about.me/lak | http://puppetlabs.com/ | +1-615-594-8199 -- 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.
