summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMorgan Haskel <morgan@puppetlabs.com>2014-10-30 10:21:36 -0700
committerMorgan Haskel <morgan@puppetlabs.com>2014-10-30 10:21:36 -0700
commit0db72ea777145cb69ce66dca3ae0ee5746c26934 (patch)
tree70285221d2e137c6aa73c5e70cac336ef5b77b57
parent385f0094883bf30c5ec7460bd0b7a1c4c29765a1 (diff)
parent6c7da72c0fa6b5e0ed3e5e2d5c80ff27f1e99dee (diff)
downloadpuppet-stdlib-0db72ea777145cb69ce66dca3ae0ee5746c26934.tar.gz
puppet-stdlib-0db72ea777145cb69ce66dca3ae0ee5746c26934.tar.bz2
Merge pull request #349 from cyberious/4.3.x
Fix validate_cmd, previous addition of SystemCallError only works for Puppet 3.7, previous version throw different exception. Wrapping in generic Exception catch all
-rw-r--r--lib/puppet/parser/functions/validate_cmd.rb4
-rwxr-xr-xspec/acceptance/validate_cmd_spec.rb4
2 files changed, 5 insertions, 3 deletions
diff --git a/lib/puppet/parser/functions/validate_cmd.rb b/lib/puppet/parser/functions/validate_cmd.rb
index c855c7e..c6136a5 100644
--- a/lib/puppet/parser/functions/validate_cmd.rb
+++ b/lib/puppet/parser/functions/validate_cmd.rb
@@ -42,8 +42,8 @@ module Puppet::Parser::Functions
rescue Puppet::ExecutionFailure => detail
msg += "\n#{detail}"
raise Puppet::ParseError, msg
- rescue SystemCallError => detail
- msg += "\nWin32::Process::SystemCallError #{detail}"
+ rescue Exception => detail
+ msg += "\n#{detail.class.name} #{detail}"
raise Puppet::ParseError, msg
ensure
tmpfile.unlink
diff --git a/spec/acceptance/validate_cmd_spec.rb b/spec/acceptance/validate_cmd_spec.rb
index a899a1d..5ac66fd 100755
--- a/spec/acceptance/validate_cmd_spec.rb
+++ b/spec/acceptance/validate_cmd_spec.rb
@@ -40,7 +40,9 @@ describe 'validate_cmd function', :unless => UNSUPPORTED_PLATFORMS.include?(fact
validate_cmd($one,$two,"aoeu is dvorak")
EOS
- expect(apply_manifest(pp, :expect_failures => true).stderr).to match(/aoeu is dvorak/)
+ apply_manifest(pp, :expect_failures => true) do |output|
+ expect(output.stderr).to match(/aoeu is dvorak/)
+ end
end
end
describe 'failure' do