summaryrefslogtreecommitdiff
path: root/lib/puppet/parser/functions
diff options
context:
space:
mode:
authorTP Honey <tphoney@users.noreply.github.com>2016-06-30 11:47:00 +0100
committerGitHub <noreply@github.com>2016-06-30 11:47:00 +0100
commit6bab96ec26c7ae7350717a0b5884d26a03e3b9ac (patch)
tree63b7caabab0694c85221c2e8f951e00665d3f5f5 /lib/puppet/parser/functions
parent70d543e66a9a0fdc670004784f4864e7a04dc4dc (diff)
parent3f86e3a731b9e1be943a55fa12bd5e32716a20ef (diff)
Merge pull request #615 from DavidS/modules-3543-update-tests-and-function
(MODULES-3543) Fixup defined_with_params to work on all puppet versions
Diffstat (limited to 'lib/puppet/parser/functions')
-rw-r--r--lib/puppet/parser/functions/defined_with_params.rb5
1 files changed, 4 insertions, 1 deletions
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