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
This commit is contained in:
Родитель
07fce232e6
Коммит
0f16bf3c5b
|
@ -228,7 +228,7 @@ module Puppet
|
||||||
See the ``periodmatch`` attribute for tuning whether to match
|
See the ``periodmatch`` attribute for tuning whether to match
|
||||||
times by their distance apart or by their specific value."
|
times by their distance apart or by their specific value."
|
||||||
|
|
||||||
newvalues(:hourly, :daily, :weekly, :monthly)
|
newvalues(:hourly, :daily, :weekly, :monthly, :never)
|
||||||
|
|
||||||
@@scale = {
|
@@scale = {
|
||||||
:hourly => 3600,
|
:hourly => 3600,
|
||||||
|
@ -246,6 +246,8 @@ module Puppet
|
||||||
}
|
}
|
||||||
|
|
||||||
def match?(previous, now)
|
def match?(previous, now)
|
||||||
|
return false if value == :never
|
||||||
|
|
||||||
value = self.value
|
value = self.value
|
||||||
case @parent[:periodmatch]
|
case @parent[:periodmatch]
|
||||||
when :number
|
when :number
|
||||||
|
|
|
@ -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("-", 15)), "matched minus 15 minutes with half-hourly")
|
||||||
assert(s.match?(min("-", 25)), "Did not match minus 25 with half-hourly")
|
assert(s.match?(min("-", 25)), "Did not match minus 25 with half-hourly")
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
# $Id$
|
# $Id$
|
||||||
|
|
Загрузка…
Ссылка в новой задаче