From 6f1d164da6fca26d41d5962c575900dfc792f004 Mon Sep 17 00:00:00 2001 From: Roman Mueller Date: Tue, 22 Sep 2015 18:05:37 +0200 Subject: Check for numeric values as empty fails on those --- lib/puppet/parser/functions/empty.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'lib/puppet/parser/functions/empty.rb') diff --git a/lib/puppet/parser/functions/empty.rb b/lib/puppet/parser/functions/empty.rb index cca620f..b5a3cde 100644 --- a/lib/puppet/parser/functions/empty.rb +++ b/lib/puppet/parser/functions/empty.rb @@ -13,14 +13,18 @@ Returns true if the variable is empty. value = arguments[0] - unless value.is_a?(Array) || value.is_a?(Hash) || value.is_a?(String) + unless value.is_a?(Array) || value.is_a?(Hash) || value.is_a?(String) || value.is_a?(Numeric) raise(Puppet::ParseError, 'empty(): Requires either ' + - 'array, hash or string to work with') + 'array, hash, string or integer to work with') end - result = value.empty? + if value.is_a?(Numeric) + return false + else + result = value.empty? - return result + return result + end end end -- cgit v1.2.3