From af875b11ff284cfe2ea95d208a614576a4342b2c Mon Sep 17 00:00:00 2001 From: David Schmitt Date: Wed, 29 Jun 2016 21:33:00 +0100 Subject: (MODULES-3543) Fix define_with_params to handle undef properly As described in PUP-6422, ensure_resources('File[/tmp/a]', { owner => undef }) would not actually create the file. This fixes it, and adds tests to prove it. --- lib/puppet/parser/functions/defined_with_params.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/puppet/parser/functions/defined_with_params.rb b/lib/puppet/parser/functions/defined_with_params.rb index d7df306..ffc7241 100644 --- a/lib/puppet/parser/functions/defined_with_params.rb +++ b/lib/puppet/parser/functions/defined_with_params.rb @@ -26,7 +26,7 @@ ENDOFDOC ret = false if resource = findresource(reference.to_s) matches = params.collect do |key, value| - resource[key] == value + resource[key] == (value.eql?(:undef) ? nil : value) # eql? avoids bugs caused by monkeypatching in puppet end ret = params.empty? || !matches.include?(false) end -- cgit v1.2.3