summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/parser/functions/defined_with_params.rb5
-rw-r--r--lib/puppet/type/file_line.rb4
2 files changed, 6 insertions, 3 deletions
diff --git a/lib/puppet/parser/functions/defined_with_params.rb b/lib/puppet/parser/functions/defined_with_params.rb
index d7df306..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? 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
diff --git a/lib/puppet/type/file_line.rb b/lib/puppet/type/file_line.rb
index f2c6937..a02b514 100644
--- a/lib/puppet/type/file_line.rb
+++ b/lib/puppet/type/file_line.rb
@@ -93,8 +93,8 @@ Puppet::Type.newtype(:file_line) do
newparam(:path) do
desc 'The file Puppet will ensure contains the line specified by the line parameter.'
validate do |value|
- unless (Puppet.features.posix? and value =~ /^\//) or (Puppet.features.microsoft_windows? and (value =~ /^.:\// or value =~ /^\/\/[^\/]+\/[^\/]+/))
- raise(Puppet::Error, "File paths must be fully qualified, not '#{value}'")
+ unless Puppet::Util.absolute_path?(value)
+ raise Puppet::Error, "File paths must be fully qualified, not '#{value}'"
end
end
end