diff options
| author | Nick Lewis <nick@puppetlabs.com> | 2011-01-06 15:56:31 -0800 |
|---|---|---|
| committer | Nick Lewis <nick@puppetlabs.com> | 2011-01-06 15:56:31 -0800 |
| commit | f663182c28c9d4533ad4c2f897e5fbbf78b16d8e (patch) | |
| tree | 28da3fd7c329de073e71b5b1ba1be01ec4e54b6f /lib/puppet/util | |
| parent | c7764723578ae64240db7bd2a64f8e6e9fa708ab (diff) | |
| parent | b16e10dba6606b808ef195f4b57f2e8c66cf65ab (diff) | |
| download | puppet-f663182c28c9d4533ad4c2f897e5fbbf78b16d8e.tar.gz puppet-f663182c28c9d4533ad4c2f897e5fbbf78b16d8e.tar.xz puppet-f663182c28c9d4533ad4c2f897e5fbbf78b16d8e.zip | |
Merge branch 'intermediate_merge_branch' into next
Diffstat (limited to 'lib/puppet/util')
| -rw-r--r-- | lib/puppet/util/checksums.rb | 11 | ||||
| -rw-r--r-- | lib/puppet/util/log.rb | 6 | ||||
| -rw-r--r-- | lib/puppet/util/log_paths.rb | 2 | ||||
| -rw-r--r-- | lib/puppet/util/logging.rb | 2 | ||||
| -rw-r--r-- | lib/puppet/util/metric.rb | 1 |
5 files changed, 17 insertions, 5 deletions
diff --git a/lib/puppet/util/checksums.rb b/lib/puppet/util/checksums.rb index 5aebd8392..6fdf14ecf 100644 --- a/lib/puppet/util/checksums.rb +++ b/lib/puppet/util/checksums.rb @@ -1,6 +1,12 @@ # A stand-alone module for calculating checksums # in a generic way. module Puppet::Util::Checksums + class FakeChecksum + def <<(*args) + self + end + end + # Is the provided string a checksum? def checksum?(string) string =~ /^\{(\w{3,5})\}\S+/ @@ -55,7 +61,10 @@ module Puppet::Util::Checksums end # by definition this doesn't exist + # but we still need to execute the block given def mtime_stream + noop_digest = FakeChecksum.new + yield noop_digest nil end @@ -105,6 +114,8 @@ module Puppet::Util::Checksums end def none_stream + noop_digest = FakeChecksum.new + yield noop_digest "" end diff --git a/lib/puppet/util/log.rb b/lib/puppet/util/log.rb index 9a9e291a6..2f9f356bb 100644 --- a/lib/puppet/util/log.rb +++ b/lib/puppet/util/log.rb @@ -190,7 +190,7 @@ class Puppet::Util::Log @levels.include?(level) end - attr_accessor :time, :remote, :file, :line, :version, :source + attr_accessor :time, :remote, :file, :line, :source attr_reader :level, :message def initialize(args) @@ -204,7 +204,7 @@ class Puppet::Util::Log tags.each { |t| self.tag(t) } end - [:file, :line, :version].each do |attr| + [:file, :line].each do |attr| next unless value = args[attr] send(attr.to_s + "=", value) end @@ -235,7 +235,7 @@ class Puppet::Util::Log descriptors[:tags].each { |t| tag(t) } - [:file, :line, :version].each do |param| + [:file, :line].each do |param| next unless descriptors[param] send(param.to_s + "=", descriptors[param]) end diff --git a/lib/puppet/util/log_paths.rb b/lib/puppet/util/log_paths.rb index f59197ed1..2fefd4505 100644 --- a/lib/puppet/util/log_paths.rb +++ b/lib/puppet/util/log_paths.rb @@ -15,7 +15,7 @@ module Puppet::Util::LogPaths descriptors[:tags] = tags - [:path, :file, :line, :version].each do |param| + [:path, :file, :line].each do |param| next unless value = send(param) descriptors[param] = value end diff --git a/lib/puppet/util/logging.rb b/lib/puppet/util/logging.rb index f20444a3b..bc52b17f0 100644 --- a/lib/puppet/util/logging.rb +++ b/lib/puppet/util/logging.rb @@ -26,7 +26,7 @@ module Puppet::Util::Logging end def log_metadata - [:file, :line, :version, :tags].inject({}) do |result, attr| + [:file, :line, :tags].inject({}) do |result, attr| result[attr] = send(attr) if respond_to?(attr) result end diff --git a/lib/puppet/util/metric.rb b/lib/puppet/util/metric.rb index 7fdc6951f..835e1d610 100644 --- a/lib/puppet/util/metric.rb +++ b/lib/puppet/util/metric.rb @@ -132,6 +132,7 @@ class Puppet::Util::Metric end def newvalue(name,value,label = nil) + raise ArgumentError.new("metric name #{name.inspect} is not a string") unless name.is_a? String label ||= self.class.labelize(name) @values.push [name,label,value] end |
