diff options
| author | Nick Lewis <nick@puppetlabs.com> | 2011-01-05 15:54:00 -0800 |
|---|---|---|
| committer | Nick Lewis <nick@puppetlabs.com> | 2011-01-05 15:54:00 -0800 |
| commit | 19eb1e78e115d10bfb822e510213e4fab9cd2599 (patch) | |
| tree | d5068dfd7a3890c7b5961779c87681b930cf3144 /lib/puppet/util | |
| parent | cc1f2b39a65e8b74c8e59a2bf7d8f47a35985ee4 (diff) | |
| parent | 83ac3e789ddc8dbf40c93460032474870fb16c54 (diff) | |
| download | puppet-19eb1e78e115d10bfb822e510213e4fab9cd2599.tar.gz puppet-19eb1e78e115d10bfb822e510213e4fab9cd2599.tar.xz puppet-19eb1e78e115d10bfb822e510213e4fab9cd2599.zip | |
Merge branch '2.6.next' into 2.6.x
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 7764dc1d1..3fdac3f69 100644 --- a/lib/puppet/util/log.rb +++ b/lib/puppet/util/log.rb @@ -189,7 +189,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) @@ -203,7 +203,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 @@ -234,7 +234,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 8f55e7b44..09bbb6137 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 ||= labelize(name) @values.push [name,label,value] end |
