diff options
| -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 |
