From 44596e73da1b157ea931d5111f842e108ca203bb Mon Sep 17 00:00:00 2001
From: Alex Tomlins <alex@tomlins.org.uk>
Date: Thu, 7 Apr 2016 22:22:17 +0100
Subject: (MODULES-3246) Fix concat with Hash arguments.

85d5ead Updated the concat function so that it wouldn't modify the
original array. A side-effect of this change is that it now always calls
`Array()` on the second argument. If thit is a Hash, this results in
`to_a` being called on the hash, which converts it to an array or
tuples. This is undesired.

Update the behaviour so that it doesn't (indirectly) call `to_a` on
anything, instead test for the type of the argument, wrapping it in an
array if it's not already an array.
---
 lib/puppet/parser/functions/concat.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'lib/puppet/parser')

diff --git a/lib/puppet/parser/functions/concat.rb b/lib/puppet/parser/functions/concat.rb
index 618e62d..91edb4e 100644
--- a/lib/puppet/parser/functions/concat.rb
+++ b/lib/puppet/parser/functions/concat.rb
@@ -31,7 +31,7 @@ Would result in:
     arguments.shift
 
     arguments.each do |x|
-      result = result + Array(x)
+      result = result + (x.is_a?(Array) ? x : [x])
     end
 
     return result
-- 
cgit v1.2.3