From dfe3a3415bffa554e47243322bba3e27ee45795d Mon Sep 17 00:00:00 2001 From: varac Date: Thu, 5 Nov 2015 21:53:09 +0100 Subject: [bug] [jessie] Fix webapp config yaml on jessie - Resolves: #7578 --- puppet/lib/puppet/parser/functions/sorted_yaml.rb | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'puppet/lib') diff --git a/puppet/lib/puppet/parser/functions/sorted_yaml.rb b/puppet/lib/puppet/parser/functions/sorted_yaml.rb index fa0db4d2..46cd46ce 100644 --- a/puppet/lib/puppet/parser/functions/sorted_yaml.rb +++ b/puppet/lib/puppet/parser/functions/sorted_yaml.rb @@ -382,7 +382,19 @@ class Ya2YAML end module Puppet::Parser::Functions - newfunction(:sorted_yaml, :type => :rvalue, :doc => "This function outputs yaml, but ensures the keys are sorted.") do |argument| - return Ya2YAML.new()._ya2yaml(argument) + newfunction(:sorted_yaml, + :type => :rvalue, + :doc => "This function outputs yaml, but ensures the keys are sorted." + ) do |arguments| + + if arguments.is_a?(Array) + if arguments.size != 1 + raise(Puppet::ParseError, "sorted_yaml(): Wrong number of arguments given (#{arguments.size} for 1)") + end + yaml = arguments.first + else + yaml = arguments + end + return Ya2YAML.new()._ya2yaml(yaml) end end -- cgit v1.2.3