diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-10-09 17:52:22 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-10-09 17:52:22 +0000 |
| commit | 08900a409350acfb3bea62ea8470095eeae450da (patch) | |
| tree | 4d7b1e16505153d1c46fbf5e735ef85a4a1e797e | |
| parent | 133c17fa6665256cafdcd1cf76d2ae50233c44f4 (diff) | |
Fixing #298 - refreshonly now correctly deals with specified false values
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1751 980ebf18-57e1-0310-9a29-db15c13687c0
| -rwxr-xr-x | lib/puppet/type/exec.rb | 7 | ||||
| -rwxr-xr-x | test/types/exec.rb | 20 |
2 files changed, 25 insertions, 2 deletions
diff --git a/lib/puppet/type/exec.rb b/lib/puppet/type/exec.rb index 8b964cbb3..c9fa0aa36 100755 --- a/lib/puppet/type/exec.rb +++ b/lib/puppet/type/exec.rb @@ -308,7 +308,12 @@ module Puppet # We always fail this test, because we're only supposed to run # on refresh. def check(value) - false + # We have to invert the values. + if value == :true + false + else + true + end end end diff --git a/test/types/exec.rb b/test/types/exec.rb index c5decb80a..0f91f74a0 100755 --- a/test/types/exec.rb +++ b/test/types/exec.rb @@ -105,7 +105,7 @@ class TestExec < Test::Unit::TestCase assert_equal(wd,command.output.chomp) end - def test_refreshonly + def test_refreshonly_functional file = nil cmd = nil tmpfile = tempfile() @@ -166,6 +166,24 @@ class TestExec < Test::Unit::TestCase ) end + def test_refreshonly + cmd = true + assert_nothing_raised { + cmd = Puppet.type(:exec).create( + :command => "pwd", + :path => "/usr/bin:/bin:/usr/sbin:/sbin", + :refreshonly => true + ) + } + + # Checks should always fail when refreshonly is enabled + assert(!cmd.check, "Check passed with refreshonly true") + + # Now set it to false + cmd[:refreshonly] = false + assert(cmd.check, "Check failed with refreshonly false") + end + def test_creates file = tempfile() exec = nil |
