Re: [Puppet Users] Review of new type provider

2011-09-21 Thread James Turnbull
Jesse Peterson wrote:
 Hello,
 
 I'm new to both Ruby and Puppet. Puppet is fantastic - loving it so
 far.
 
 I created a new type  provider (of parsed file type) for modifying
 newsyslog.conf files and am hoping some folks would be willing to
 review it to make sure there are no glaring mistakes or perhaps some
 shortcuts or language features I've missed since I'm new to both. Any
 input would be welcome. Either email directly or just comment on the
 gist if it gets to be off topic:
 
 https://gist.github.com/1230749

Looks okay to me - I'd recommend writing some tests for it - ParsedFile
providers are notorious for subtle bugs and small changes causing odd
effects.

 
 How often do new types/providers make it into the base system? Should
 one pursue that avenue (or perhaps the puppet modules project?).

We're trying to keep the core lean and mean. So I'd recommend creating
and adding a module to the Forge (http://forge.puppetlabs.com) with your
new type and provider.

Regards

James

-- 
James Turnbull
Puppet Labs
1-503-734-8571

Join us for PuppetConf http://www.bit.ly/puppetconfsig, September 22nd
and 23rd in Portland, Oregon, USA.

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



Re: [Puppet Users] Review of new type provider

2011-09-21 Thread Jacob Helwig
On Tue, 20 Sep 2011 23:19:36 -0700, James Turnbull wrote:
 
 Jesse Peterson wrote:
  Hello,
  
  I'm new to both Ruby and Puppet. Puppet is fantastic - loving it so
  far.
  
  I created a new type  provider (of parsed file type) for modifying
  newsyslog.conf files and am hoping some folks would be willing to
  review it to make sure there are no glaring mistakes or perhaps some
  shortcuts or language features I've missed since I'm new to both. Any
  input would be welcome. Either email directly or just comment on the
  gist if it gets to be off topic:
  
  https://gist.github.com/1230749
 
 Looks okay to me - I'd recommend writing some tests for it - ParsedFile
 providers are notorious for subtle bugs and small changes causing odd
 effects.
 
  
  How often do new types/providers make it into the base system? Should
  one pursue that avenue (or perhaps the puppet modules project?).
 
 We're trying to keep the core lean and mean. So I'd recommend creating
 and adding a module to the Forge (http://forge.puppetlabs.com) with your
 new type and provider.
 
 Regards
 
 James
 

I'd definitely recommend writing tests for it, as well.  If you're
looking for some examples of tests around parsed file based types,
you might want to take a look at some of the work that was done to split
out the mount type into two separate types[1].

The only tricky part of copying the test setup from the split mount
types is that you'll need to have the puppet and facter source trees in
addition to your new type's source tree, and make sure that it's
available to ruby when you run the tests.

I've been achieving this by running the tests with the following:

  RUBYLIB=`pwd`/../puppet/lib:`pwd`/../facter/lib rspec spec

We should really go back and create a README with this info for the
split mount type repo.

[1] https://github.com/puppetlabs/puppetlabs-mount-providers

-- 
Jacob Helwig
,
| Join us for PuppetConf, September 22nd and 23rd in Portland, OR
| http://bit.ly/puppetconfsig
`


signature.asc
Description: Digital signature


[Puppet Users] Review of new type provider

2011-09-20 Thread Jesse Peterson
Hello,

I'm new to both Ruby and Puppet. Puppet is fantastic - loving it so
far.

I created a new type  provider (of parsed file type) for modifying
newsyslog.conf files and am hoping some folks would be willing to
review it to make sure there are no glaring mistakes or perhaps some
shortcuts or language features I've missed since I'm new to both. Any
input would be welcome. Either email directly or just comment on the
gist if it gets to be off topic:

https://gist.github.com/1230749

How often do new types/providers make it into the base system? Should
one pursue that avenue (or perhaps the puppet modules project?).

Thanks for any assistence or guidance,
- Jesse

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