summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-02-28 00:14:27 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-02-28 00:14:27 +0000
commit0f16bf3c5b925f5656a5592b527ae56d92c662f9 (patch)
tree73fa3f284efcef9529da9234b5fb9ec2daff5fcb
parent07fce232e6a0bb0cfd2e1c84b933e41f851a2045 (diff)
downloadpuppet-0f16bf3c5b925f5656a5592b527ae56d92c662f9.tar.gz
puppet-0f16bf3c5b925f5656a5592b527ae56d92c662f9.tar.xz
puppet-0f16bf3c5b925f5656a5592b527ae56d92c662f9.zip
Fixing #526. Implemented as a period of "never", rather than adding a new parameter.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2238 980ebf18-57e1-0310-9a29-db15c13687c0
-rwxr-xr-xlib/puppet/type/schedule.rb4
-rwxr-xr-xtest/ral/types/schedule.rb12
2 files changed, 15 insertions, 1 deletions
diff --git a/lib/puppet/type/schedule.rb b/lib/puppet/type/schedule.rb
index e664a6e0c..c68422849 100755
--- a/lib/puppet/type/schedule.rb
+++ b/lib/puppet/type/schedule.rb
@@ -228,7 +228,7 @@ module Puppet
See the ``periodmatch`` attribute for tuning whether to match
times by their distance apart or by their specific value."
- newvalues(:hourly, :daily, :weekly, :monthly)
+ newvalues(:hourly, :daily, :weekly, :monthly, :never)
@@scale = {
:hourly => 3600,
@@ -246,6 +246,8 @@ module Puppet
}
def match?(previous, now)
+ return false if value == :never
+
value = self.value
case @parent[:periodmatch]
when :number
diff --git a/test/ral/types/schedule.rb b/test/ral/types/schedule.rb
index e50f88bab..e9b3ef8b3 100755
--- a/test/ral/types/schedule.rb
+++ b/test/ral/types/schedule.rb
@@ -340,6 +340,18 @@ class TestSchedule < Test::Unit::TestCase
assert(! s.match?(min("-", 15)), "matched minus 15 minutes with half-hourly")
assert(s.match?(min("-", 25)), "Did not match minus 25 with half-hourly")
end
+
+ # #526
+ def test_never_period
+ schedule = nil
+ assert_nothing_raised do
+ schedule = Puppet::Type.type(:schedule).create(
+ :name => "test", :period => :never
+ )
+ end
+
+ assert(! schedule.match?, "schedule matched with period == never")
+ end
end
# $Id$