[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. puppet-0.24.5-rc3-1456-g2f0b1e5
James Turnbull
james at lovedthanlost.net
Tue Oct 27 17:06:16 UTC 2009
The following commit has been merged in the upstream branch:
commit 7517572949e4e0efc419f97cf2663588af8b9756
Author: Jesse Wolfe <jes5199 at gmail.com>
Date: Sun Oct 25 23:14:13 2009 -0700
Bug #1908 cron environment should allow empty vals
Change regexp to allow cron environment => "MAILTO="
Signed-off-by: Jesse Wolfe <jes5199 at gmail.com>
diff --git a/lib/puppet/type/cron.rb b/lib/puppet/type/cron.rb
index 1269f38..1cdd561 100755
--- a/lib/puppet/type/cron.rb
+++ b/lib/puppet/type/cron.rb
@@ -312,7 +312,7 @@ Puppet::Type.newtype(:cron) do
the crontab, e.g., ``PATH=/bin:/usr/bin:/usr/sbin``."
validate do |value|
- unless value =~ /^\s*(\w+)\s*=\s*(.+)\s*$/ or value == :absent or value == "absent"
+ unless value =~ /^\s*(\w+)\s*=\s*(.*)\s*$/ or value == :absent or value == "absent"
raise ArgumentError, "Invalid environment setting %s" %
value.inspect
end
diff --git a/spec/unit/type/cron.rb b/spec/unit/type/cron.rb
new file mode 100755
index 0000000..6951077
--- /dev/null
+++ b/spec/unit/type/cron.rb
@@ -0,0 +1,33 @@
+#!/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) do
+ before do
+ @cron = Puppet::Type.type(:cron).new( :name => "foo" )
+ end
+
+ it "it should accept an :environment that looks like a path" do
+ lambda do
+ @cron[:environment] = 'PATH=/bin:/usr/bin:/usr/sbin'
+ end.should_not raise_error
+ end
+
+ it "should not accept environment variables that do not contain '='" do
+ lambda do
+ @cron[:environment] = "INVALID"
+ end.should raise_error(Puppet::Error)
+ end
+
+ it "should accept empty environment variables that do not contain '='" do
+ lambda do
+ @cron[:environment] = "MAILTO="
+ end.should_not raise_error(Puppet::Error)
+ end
+
+ it "should accept 'absent'" do
+ lambda do
+ @cron[:environment] = 'absent'
+ end.should_not raise_error(Puppet::Error)
+ end
+end
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list