diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-07-14 21:13:04 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-07-14 21:13:04 +0000 |
commit | 60ef57815050497110925283299efde2b7aafcd2 (patch) | |
tree | 0d4369666d8206ba89a45040201c9812e33021ab /lib/puppet | |
parent | 53c2f0a4c93d51eed664761bc652e73ccf078a82 (diff) | |
download | puppet-60ef57815050497110925283299efde2b7aafcd2.tar.gz puppet-60ef57815050497110925283299efde2b7aafcd2.tar.xz puppet-60ef57815050497110925283299efde2b7aafcd2.zip |
Fixing the rest of #705, except for the env stuff, which I was not able to reproduce.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2697 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet')
-rwxr-xr-x | lib/puppet/provider/cron/crontab.rb | 1 | ||||
-rwxr-xr-x | lib/puppet/type/cron.rb | 8 | ||||
-rw-r--r-- | lib/puppet/util/fileparsing.rb | 8 |
3 files changed, 13 insertions, 4 deletions
diff --git a/lib/puppet/provider/cron/crontab.rb b/lib/puppet/provider/cron/crontab.rb index fcf86fc46..3296544f9 100755 --- a/lib/puppet/provider/cron/crontab.rb +++ b/lib/puppet/provider/cron/crontab.rb @@ -30,6 +30,7 @@ Puppet::Type.type(:cron).provide(:crontab, } crontab = record_line :crontab, :fields => %w{minute hour monthday month weekday command}, + :match => %r{^(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(.+)$}, :optional => %w{minute hour weekday month monthday}, :absent => "*" class << crontab diff --git a/lib/puppet/type/cron.rb b/lib/puppet/type/cron.rb index f0188e8e7..84a8d8af6 100755 --- a/lib/puppet/type/cron.rb +++ b/lib/puppet/type/cron.rb @@ -301,8 +301,12 @@ Puppet::Type.newtype(:cron) do end def is_to_s(newvalue) - if newvalue - newvalue.join(",") + if newvalue + if newvalue.is_a?(Array) + newvalue.join(",") + else + newvalue + end else nil end diff --git a/lib/puppet/util/fileparsing.rb b/lib/puppet/util/fileparsing.rb index 545a54071..8e69681cf 100644 --- a/lib/puppet/util/fileparsing.rb +++ b/lib/puppet/util/fileparsing.rb @@ -168,8 +168,12 @@ module Puppet::Util::FileParsing if match = regex.match(line) fields = [] ret = {} - record.fields.zip(match.captures).each do |f, v| - ret[f] = v + record.fields.zip(match.captures).each do |field, value| + if value == record.absent + ret[field] = :absent + else + ret[field] = value + end end else nil |