diff options
author | Bryan Jen <bryan.jen@gmail.com> | 2015-09-21 11:20:35 -0700 |
---|---|---|
committer | Bryan Jen <bryan.jen@gmail.com> | 2015-09-21 11:20:35 -0700 |
commit | 97bd656efbd4ef70bb321f728e0f611fa931ad02 (patch) | |
tree | ca2f93dd6d459eac114f1e0b5cac05ac02d519cd /lib/puppet/parser | |
parent | 9b1932c538354c1b360838c8cf7b942af314c99d (diff) | |
parent | 799c38e14e1583e676e2b25a9c1782fd40e29fff (diff) |
Merge pull request #527 from mhaskel/511_compatibility
Fix backwards compatibility from #511
Diffstat (limited to 'lib/puppet/parser')
-rw-r--r-- | lib/puppet/parser/functions/parsejson.rb | 10 | ||||
-rw-r--r-- | lib/puppet/parser/functions/parseyaml.rb | 10 |
2 files changed, 14 insertions, 6 deletions
diff --git a/lib/puppet/parser/functions/parsejson.rb b/lib/puppet/parser/functions/parsejson.rb index f822fc4..b4af40e 100644 --- a/lib/puppet/parser/functions/parsejson.rb +++ b/lib/puppet/parser/functions/parsejson.rb @@ -3,7 +3,7 @@ # module Puppet::Parser::Functions - newfunction(:parsejson, :type => :rvalue, :arity => -2, :doc => <<-EOS + newfunction(:parsejson, :type => :rvalue, :doc => <<-EOS This function accepts JSON as a string and converts it into the correct Puppet structure. @@ -15,8 +15,12 @@ be returned if the parsing of YAML string have failed. begin PSON::load(arguments[0]) || arguments[1] - rescue Exception - arguments[1] + rescue Exception => e + if arguments[1] + arguments[1] + else + raise e + end end end diff --git a/lib/puppet/parser/functions/parseyaml.rb b/lib/puppet/parser/functions/parseyaml.rb index d38b3ef..66d0413 100644 --- a/lib/puppet/parser/functions/parseyaml.rb +++ b/lib/puppet/parser/functions/parseyaml.rb @@ -3,7 +3,7 @@ # module Puppet::Parser::Functions - newfunction(:parseyaml, :type => :rvalue, :arity => -2, :doc => <<-EOS + newfunction(:parseyaml, :type => :rvalue, :doc => <<-EOS This function accepts YAML as a string and converts it into the correct Puppet structure. @@ -16,8 +16,12 @@ be returned if the parsing of YAML string have failed. begin YAML::load(arguments[0]) || arguments[1] - rescue Exception - arguments[1] + rescue Exception => e + if arguments[1] + arguments[1] + else + raise e + end end end |