summaryrefslogtreecommitdiffstats
path: root/lib/puppet/util/log.rb
diff options
context:
space:
mode:
authorJames Turnbull <james@lovedthanlost.net>2010-01-13 08:07:30 +1100
committerJames Turnbull <james@lovedthanlost.net>2010-01-13 08:07:30 +1100
commitb6f90dfcd96123c245b6f5fd93753790006387c0 (patch)
tree1668fd8ed480dc0d0cb49c4a3d7f8a13c77dbeb9 /lib/puppet/util/log.rb
parente26e8319186c57a41ea7ca58b0e8e853e9b452e3 (diff)
parentf7e14356ad7781fafa52a459d3c24372fa6c0900 (diff)
downloadpuppet-b6f90dfcd96123c245b6f5fd93753790006387c0.tar.gz
puppet-b6f90dfcd96123c245b6f5fd93753790006387c0.tar.xz
puppet-b6f90dfcd96123c245b6f5fd93753790006387c0.zip
Merge branch '0.25.x'
Conflicts: lib/puppet/ssl/host.rb spec/spec_helper.rb
Diffstat (limited to 'lib/puppet/util/log.rb')
-rw-r--r--lib/puppet/util/log.rb28
1 files changed, 10 insertions, 18 deletions
diff --git a/lib/puppet/util/log.rb b/lib/puppet/util/log.rb
index 4cdad700c..90d722900 100644
--- a/lib/puppet/util/log.rb
+++ b/lib/puppet/util/log.rb
@@ -511,11 +511,16 @@ class Puppet::Util::Log
# If they pass a source in to us, we make sure it is a string, and
# we retrieve any tags we can.
def source=(source)
- # We can't store the actual source, we just store the path.
- # 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)
- set_source_from_ral(source)
+ if source.respond_to?(:source_descriptors)
+ descriptors = source.source_descriptors
+ @source = descriptors[:path]
+
+ descriptors[:tags].each { |t| tag(t) }
+
+ [:file, :line, :version].each do |param|
+ next unless descriptors[param]
+ send(param.to_s + "=", descriptors[param])
+ end
else
@source = source.to_s
end
@@ -528,19 +533,6 @@ 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 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