summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xlib/puppet/type/cron.rb12
-rwxr-xr-xtest/types/cron.rb28
2 files changed, 40 insertions, 0 deletions
diff --git a/lib/puppet/type/cron.rb b/lib/puppet/type/cron.rb
index ea34f4629..917a6ffb1 100755
--- a/lib/puppet/type/cron.rb
+++ b/lib/puppet/type/cron.rb
@@ -256,6 +256,14 @@ module Puppet
class << self
attr_accessor :filetype
+
+ def cronobj(name)
+ if defined? @tabs
+ return @tabs[name]
+ else
+ return nil
+ end
+ end
end
attr_accessor :uid
@@ -353,6 +361,10 @@ module Puppet
when /^#/:
# add other comments to the list as they are
@instances[user] << line
+ when /^\s*(\w+)\s*=\s*(.+)\s*$/:
+ # Match env settings. For now, just chunk them in there,
+ # but eventually we'll want to manage them in the model somehow.
+ @instances[user] << line
else
if match = /^(\S+) (\S+) (\S+) (\S+) (\S+) (.+)$/.match(line)
fields().zip(match.captures).each { |param, value|
diff --git a/test/types/cron.rb b/test/types/cron.rb
index 496274d88..22c2e98f9 100755
--- a/test/types/cron.rb
+++ b/test/types/cron.rb
@@ -422,6 +422,34 @@ class TestCron < Test::Unit::TestCase
end
end
end
+
+ # Make sure we don't puke on env settings
+ def test_envsettings
+ cron = mkcron("envtst")
+
+ assert_apply(cron)
+
+ obj = Puppet::Type::Cron.cronobj(@me)
+
+ assert(obj)
+
+ text = obj.read
+
+ text = "SHELL = /path/to/some/thing\n" + text
+
+ obj.write(text)
+
+ assert_nothing_raised {
+ cron.retrieve
+ }
+
+ cron[:command] = "/some/other/command"
+
+ assert_apply(cron)
+
+ assert(obj.read =~ /SHELL/, "lost env setting")
+
+ end
end
# $Id$