+1 On Tue, Jan 5, 2010 at 7:12 PM, Jesse Wolfe <[email protected]> wrote: > Merged the "freebsd_special" pattern into the other crontab records, > since its definition was incomplete > > Signed-off-by: Jesse Wolfe <[email protected]> > --- > lib/puppet/provider/cron/crontab.rb | 13 ++++--------- > spec/unit/provider/cron/crontab.rb | 21 +++++++++++++++++++++ > 2 files changed, 25 insertions(+), 9 deletions(-) > create mode 100755 spec/unit/provider/cron/crontab.rb > > diff --git a/lib/puppet/provider/cron/crontab.rb > b/lib/puppet/provider/cron/crontab.rb > index 6dee2e5..28ef059 100755 > --- a/lib/puppet/provider/cron/crontab.rb > +++ b/lib/puppet/provider/cron/crontab.rb > @@ -27,18 +27,13 @@ Puppet::Type.type(:cron).provide(:crontab, > > text_line :environment, :match => %r{^\w+=} > > - record_line :freebsd_special, :fields => %w{special command}, > - :match => %r{^@(\w+)\s+(.+)$}, :pre_gen => proc { |record| > - record[:special] = "@" + record[:special] > - } > - > - crontab = record_line :crontab, :fields => %w{minute hour monthday month > weekday command}, > - :match => %r{^\s*(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(.+)$}, > - :optional => %w{minute hour weekday month monthday}, :absent => "*" > + crontab = record_line :crontab, :fields => %w{special minute hour > monthday month weekday command}, > + :match => > %r{^\s*(?:@(\w+)|(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+))\s+(.+)$}, > + :optional => %w{special minute hour weekday month monthday}, :absent > => "*" > > class << crontab > def numeric_fields > - fields - [:command] > + fields - [:command, :special] > end > # Do some post-processing of the parsed record. Basically just > # split the numeric fields on ','. > diff --git a/spec/unit/provider/cron/crontab.rb > b/spec/unit/provider/cron/crontab.rb > new file mode 100755 > index 0000000..5904a58 > --- /dev/null > +++ b/spec/unit/provider/cron/crontab.rb > @@ -0,0 +1,21 @@ > +#!/usr/bin/env ruby > + > +Dir.chdir(File.dirname(__FILE__)) { (s = lambda { |f| File.exist?(f) ? > require(f) : Dir.chdir("..") { s.call(f) } }).call("spec/spec_helper.rb") } > + > +describe Puppet::Type.type(:cron).provider(:crontab) do > + before :each do > + �...@cron_type = Puppet::Type.type(:cron) > + �...@provider = @cron_type.provider(:crontab) > + end > + > + it "should round-trip the name as a comment for @special events" do > + parse = @provider.parse <<-CRON > +# Puppet Name: test > +...@reboot /bin/echo > /tmp/puppet.txt > + CRON > + prefetch = @provider.prefetch_hook(parse) > + > + �[email protected]_line(prefetch[0]).should =~ /Puppet Name: test/ > + end > + > +end > -- > 1.6.5 > > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Developers" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/puppet-dev?hl=en. > > > >
-- ----------------------------------------------------------- The power of accurate observation is commonly called cynicism by those who have not got it. ~George Bernard Shaw ------------------------------------------------------------
-- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.
