ad
2012-Jul-09 22:23 UTC
[Puppet Users] Custom ruby modules/classes, standard namespacing, pluginsync, etc.
still pretty new to Ruby, please bare with me :) Say I have a module with a custom type, structured like so: [modules]/mymodule/manifests/init.pp [modules]/mymodule/lib/puppet/provider/mytype/foo.rb [modules]/mymodule/lib/puppet/type/mytype.rb In foo.rb, I''d like to call some custom ruby functions in a module and/ or class. These are generic functions that may be used in other modules, e.g. md5.rb with a collection of MD5 functions/methods. I was thinking a generic ''custom'' module laid out something like [modules]/custom/lib/puppet/md5.rb [modules]/custom/lib/puppet/networking.rb What''s the best place to put these so they get autoloaded by pluginsync, and what is the preferred approach for namespacing? Basically how do I require these within other modules. Poking around the forge, I''ve seen things like [modules]/custom/lib/puppet/util/md5.rb and [modules]/custom/lib/puppet/modules/md5.rb But often there seem to be hacks used to load these. Regards, Adam -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
ad
2012-Jul-10 03:08 UTC
[Puppet Users] Re: Custom ruby modules/classes, standard namespacing, pluginsync, etc.
how bout a basic 2 modules one which calls a function in the other example? On Jul 9, 5:23 pm, ad <adam.denn...@gmail.com> wrote:> still pretty new to Ruby, please bare with me :) Say I have a module > with a custom type, structured like so: > > [modules]/mymodule/manifests/init.pp > [modules]/mymodule/lib/puppet/provider/mytype/foo.rb > [modules]/mymodule/lib/puppet/type/mytype.rb > > In foo.rb, I''d like to call some custom ruby functions in a module and/ > or class. These are generic functions that may be used in other > modules, e.g. md5.rb with a collection of MD5 functions/methods. > > I was thinking a generic ''custom'' module laid out something like > > [modules]/custom/lib/puppet/md5.rb > [modules]/custom/lib/puppet/networking.rb > > What''s the best place to put these so they get autoloaded by > pluginsync, and what is the preferred approach for namespacing? > Basically how do I require these within other modules. > > Poking around the forge, I''ve seen things like > > [modules]/custom/lib/puppet/util/md5.rb > > and > > [modules]/custom/lib/puppet/modules/md5.rb > > But often there seem to be hacks used to load these. > > Regards, > > Adam-- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.