hajducko@gmail.com
2008-May-21 20:07 UTC
[Puppet Users] Custom providers via plugin modules?
So is it possible to sync out custom providers for existing types via the same plugins inmodules type mechanism? So, if we are using our custom module and our modulepath is /etc/ puppet/modules then the custom provider for the user type would be stored in the following? /etc/puppet/modules/custom/plugins/puppet/provider/user Or should I just create the new provider for user in the site_ruby lib/ puppet/provider/user directory? Last question - there any documentation or methods for easily testing new providers? I''m pretty experienced with perl and python but ruby is a bit new and I''m still learning the syntax, so half the errors are my own stupid syntax errors. Just curious if there is a better way than changing the provider, syncing it out to the client, restarting puppetmaster and sending a USR1 to the puppet client to do a configuration run? Thanks sh --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On May 21, 2008, at 3:07 PM, hajducko@gmail.com wrote:> > So is it possible to sync out custom providers for existing types via > the same plugins inmodules type mechanism? > > So, if we are using our custom module and our modulepath is /etc/ > puppet/modules then the custom provider for the user type would be > stored in the following? > > /etc/puppet/modules/custom/plugins/puppet/provider/user > > Or should I just create the new provider for user in the site_ruby > lib/ > puppet/provider/user directory?Pluginsync should work fine for adding providers to existing types and is definitely the recommended method.> > Last question - there any documentation or methods for easily testing > new providers? I''m pretty experienced with perl and python but ruby > is a bit new and I''m still learning the syntax, so half the errors are > my own stupid syntax errors. Just curious if there is a better way > than changing the provider, syncing it out to the client, restarting > puppetmaster and sending a USR1 to the puppet client to do a > configuration run?I definitely recommend unit tests -- you should be able to crip from existing tests in the Puppet repo. Unfortunately, no one has yet set up an easy-to-copy rspec setup that you can use in a module set, but it''s something I dearly want. It shouldn''t be too hard to start using rspec for providers, though. Once you''ve got good tests, most of the work is done. Then set your modulepath appropriately and use the ''puppet'' executable, rather than the client/server. Much faster, you can test stand-alone, and you don''t even need access to the server. -- You''ve got to take the bitter with the sour. -- Samuel Goldwyn --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Gunnar Wrobel
2008-May-23 13:46 UTC
[Puppet Users] Re: Custom providers via plugin modules?
On 22 Mai, 05:20, Luke Kanies <l...@madstop.com> wrote:> On May 21, 2008, at 3:07 PM, hajdu...@gmail.com wrote: > > > > > So is it possible to sync out custom providers for existing types via > > the same plugins inmodules type mechanism? > > > So, if we are using our custom module and our modulepath is /etc/ > > puppet/modules then the custom provider for the user type would be > > stored in the following? > > > /etc/puppet/modules/custom/plugins/puppet/provider/user > > > Or should I just create the new provider for user in the site_ruby > > lib/ > > puppet/provider/user directory? > > Pluginsync should work fine for adding providers to existing types and > is definitely the recommended method. > > > > > Last question - there any documentation or methods for easily testing > > new providers? I''m pretty experienced with perl and python but ruby > > is a bit new and I''m still learning the syntax, so half the errors are > > my own stupid syntax errors. Just curious if there is a better way > > than changing the provider, syncing it out to the client, restarting > > puppetmaster and sending a USR1 to the puppet client to do a > > configuration run? > > I definitely recommend unit tests -- you should be able to crip from > existing tests in the Puppet repo. Unfortunately, no one has yet set > up an easy-to-copy rspec setup that you can use in a module set, but > it''s something I dearly want. It shouldn''t be too hard to start using > rspec for providers, though.I have pretty much the same situation as hajducko. I''m still new with ruby and the syntax is not yet familiar. When Luke asked me to provide some unit tests for a patch of mine (http://reductivelabs.com/trac/puppet/ticket/1179) I was afraid that learning to write unit tests in ruby would turn out to be quite painful. But it actually took only half an hour which was a very positive surprise. I am currently establishing a puppet configuration for a groupware server which also requires some ruby plugins. Today I took the time to see if I could get up and running with unit tests for plugins, too. This module holds my first working test: http://github.com/wrobel/pardalys/tree/master/pardalys/modules/root The "spec" subdir holds a unit test for a puppet function defined in the "plugins" directory. Granted, the function I''m testing there is not the most intelligent one but it may be an example to start with. I guess the testing framework for the puppet libraries is far more elaborat and I don''t know if executing the unit tests directly is really the intended way of dealing with this but I guess for small tests this should be fine. Cheers, Gunnar> > Once you''ve got good tests, most of the work is done. Then set your > modulepath appropriately and use the ''puppet'' executable, rather than > the client/server. Much faster, you can test stand-alone, and you > don''t even need access to the server. > > -- > You''ve got to take the bitter with the sour. > -- Samuel Goldwyn > --------------------------------------------------------------------- > Luke Kanies |http://reductivelabs.com|http://madstop.com--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---