From 3f86e3a731b9e1be943a55fa12bd5e32716a20ef Mon Sep 17 00:00:00 2001
From: David Schmitt <david@black.co.at>
Date: Thu, 30 Jun 2016 11:06:56 +0100
Subject: (MODULES-3543) Fixup defined_with_params to work on all puppet
 versions

---
 lib/puppet/parser/functions/defined_with_params.rb | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

(limited to 'lib/puppet/parser/functions')

diff --git a/lib/puppet/parser/functions/defined_with_params.rb b/lib/puppet/parser/functions/defined_with_params.rb
index ffc7241..99687ae 100644
--- a/lib/puppet/parser/functions/defined_with_params.rb
+++ b/lib/puppet/parser/functions/defined_with_params.rb
@@ -26,7 +26,10 @@ ENDOFDOC
   ret = false
   if resource = findresource(reference.to_s)
     matches = params.collect do |key, value|
-      resource[key] == (value.eql?(:undef) ? nil : value)  # eql? avoids bugs caused by monkeypatching in puppet
+      # eql? avoids bugs caused by monkeypatching in puppet
+      resource_is_undef = resource[key].eql?(:undef) || resource[key].nil?
+      value_is_undef = value.eql?(:undef) || value.nil?
+      (resource_is_undef && value_is_undef) || (resource[key] == value)
     end
     ret = params.empty? || !matches.include?(false)
   end
-- 
cgit v1.2.3