On Tue, Jul 17, 2012 at 9:49 AM, Nan Liu <n...@puppetlabs.com> wrote:

> On Tue, Jul 17, 2012 at 8:34 AM, ZJE <countac...@gmail.com> wrote:
> > I'd like to reuse the same ruby code in a type across all the providers.
> For
> > the type I'm writing, a certain portion of the "exists?" method would be
> > repeated across all providers. From looking at the documentation,
> > http://docs.puppetlabs.com/guides/custom_types.html, it's not quite
> clear
> > how I can accomplish this.  I've looked at writing a function, but that
> > seems to be for a larger scope than I'd like (only the providers in that
> > module would need this code) and requires a restart of the puppet master.
>
> Look at puppetlabs registry provider[1] for an example where
> modules/registry is shared between registry_key and registry_value.


We've actually got this wrong in the registry module currently.  Shared
utility code should not go into the Puppet namespace at all.

The convention we've "standardized" [1] on is:

"Start with PuppetX, put the CamelCase of your author name (from the
Modulefile), then put the actual CamelCase of your module name"

So the registry module should be PuppetX::PuppetLabs::Registry living in
'<modulepath>/registry/lib/puppet_x/puppet_labs/registry.rb'

Puppet::Modules::Registry is a bad example and should not be followed.

[1] http://projects.puppetlabs.com/issues/14149

-Jeff

-- 
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.

Reply via email to