summaryrefslogtreecommitdiff
path: root/lib/puppet/parser/functions
diff options
context:
space:
mode:
authorAdrien Thebo <git@somethingsinistral.net>2013-09-18 10:08:49 -0700
committerAdrien Thebo <git@somethingsinistral.net>2013-09-18 10:08:49 -0700
commit7ccf8cf09bb9dcdb59e1b2184a1f595dfa4a4340 (patch)
treef80b0677bd92aad3e268935b4b3e165c30323cb5 /lib/puppet/parser/functions
parentc2f584d2c2bb7f37a5dc83a9ef36a4a7db1170a6 (diff)
parent80a8b7bd1fdb3aadd53d112ce9a20b86d8ea9a62 (diff)
downloadpuppet-stdlib-7ccf8cf09bb9dcdb59e1b2184a1f595dfa4a4340.tar.gz
puppet-stdlib-7ccf8cf09bb9dcdb59e1b2184a1f595dfa4a4340.tar.bz2
Merge pull request #184 from lmello/fix_bug_20681_delete_undef_values
delete_undef_values function fix bug #20681
Diffstat (limited to 'lib/puppet/parser/functions')
-rw-r--r--lib/puppet/parser/functions/delete_undef_values.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/puppet/parser/functions/delete_undef_values.rb b/lib/puppet/parser/functions/delete_undef_values.rb
index 4eecab2..532639e 100644
--- a/lib/puppet/parser/functions/delete_undef_values.rb
+++ b/lib/puppet/parser/functions/delete_undef_values.rb
@@ -18,16 +18,16 @@ Would return: ['A','',false]
raise(Puppet::ParseError,
"delete_undef_values(): Wrong number of arguments given " +
"(#{args.size})") if args.size < 1
-
- result = args[0]
+
+ unless args[0].is_a? Array or args[0].is_a? Hash
+ raise(Puppet::ParseError,
+ "delete_undef_values(): expected an array or hash, got #{args[0]} type #{args[0].class} ")
+ end
+ result = args[0].dup
if result.is_a?(Hash)
result.delete_if {|key, val| val.equal? :undef}
elsif result.is_a?(Array)
result.delete :undef
- else
- raise(Puppet::ParseError,
- "delete_undef_values(): Wrong argument type #{args[0].class} " +
- "for first argument")
end
result
end