summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/util/log.rb23
1 files changed, 14 insertions, 9 deletions
diff --git a/lib/puppet/util/log.rb b/lib/puppet/util/log.rb
index 6edc7f482..d6d3ba018 100644
--- a/lib/puppet/util/log.rb
+++ b/lib/puppet/util/log.rb
@@ -515,18 +515,10 @@ class Puppet::Util::Log
# We can't just check for whether it responds to :path, because
# plenty of providers respond to that in their normal function.
if (source.is_a?(Puppet::Type) or source.is_a?(Puppet::Parameter)) and source.respond_to?(:path)
- @source = source.path
+ set_source_from_ral(source)
else
@source = source.to_s
end
- if source.respond_to?(:tags)
- source.tags.each { |t| tag(t) }
- end
-
- [:file, :line, :version].each do |param|
- next unless source.respond_to?(param)
- send(param.to_s + "=", source.send(param))
- end
end
def to_report
@@ -536,6 +528,19 @@ class Puppet::Util::Log
def to_s
return @message
end
+
+ private
+
+ def set_source_from_ral(source)
+ @source = source.path
+
+ source.tags.each { |t| tag(t) }
+
+ [:file, :line, :version].each do |param|
+ next unless source.respond_to?(param) and value = source.send(param)
+ send(param.to_s + "=", value)
+ end
+ end
end
# This is for backward compatibility from when we changed the constant to Puppet::Util::Log