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

Attachment: signature.asc
Description: Digital signature

Reply via email to