This attribute was only relevant in reports, and in reports it was
redundant with Puppet::Transaction::Report#configuration_version and
Puppet::Transaction::Report#puppet_version.

Signed-off-by: Paul Berry <[email protected]>
---
 lib/puppet/util/log.rb              |    6 +++---
 lib/puppet/util/log_paths.rb        |    2 +-
 lib/puppet/util/logging.rb          |    2 +-
 spec/unit/parameter_spec.rb         |    3 +--
 spec/unit/resource/status_spec.rb   |    2 +-
 spec/unit/transaction/event_spec.rb |    2 +-
 spec/unit/type_spec.rb              |    2 +-
 spec/unit/util/log_spec.rb          |   31 +++++++++++++++++++------------
 spec/unit/util/logging_spec.rb      |    2 +-
 9 files changed, 29 insertions(+), 23 deletions(-)

diff --git a/lib/puppet/util/log.rb b/lib/puppet/util/log.rb
index 7764dc1..3fdac3f 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 f59197e..2fefd45 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 f20444a..bc52b17 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/spec/unit/parameter_spec.rb b/spec/unit/parameter_spec.rb
index 966bbfb..f8ab05d 100755
--- a/spec/unit/parameter_spec.rb
+++ b/spec/unit/parameter_spec.rb
@@ -52,8 +52,7 @@ describe Puppet::Parameter do
     @resource.expects(:line).returns 10
     @resource.expects(:file).returns "file"
     @resource.expects(:tags).returns %w{one two}
-    @resource.expects(:version).returns 50
-    @parameter.source_descriptors.should == {:tags=>["one", "two", "foo"], 
:path=>"//foo", :version=>50, :file => "file", :line => 10}
+    @parameter.source_descriptors.should == {:tags=>["one", "two", "foo"], 
:path=>"//foo", :file => "file", :line => 10}
   end
 
   describe "when returning the value" do
diff --git a/spec/unit/resource/status_spec.rb 
b/spec/unit/resource/status_spec.rb
index 945b8f6..08cb99b 100755
--- a/spec/unit/resource/status_spec.rb
+++ b/spec/unit/resource/status_spec.rb
@@ -74,7 +74,7 @@ describe Puppet::Resource::Status do
       @status.send_log :notice, "my message"
     end
 
-    [:file, :line, :version].each do |attr|
+    [:file, :line].each do |attr|
       it "should pass the #{attr}" do
         Puppet::Util::Log.expects(:new).with { |args| args[attr] == "my val" }
         @status.send(attr.to_s + "=", "my val")
diff --git a/spec/unit/transaction/event_spec.rb 
b/spec/unit/transaction/event_spec.rb
index 0528402..f1db383 100755
--- a/spec/unit/transaction/event_spec.rb
+++ b/spec/unit/transaction/event_spec.rb
@@ -83,7 +83,7 @@ describe Puppet::Transaction::Event do
       Puppet::Transaction::Event.new(:tags => %w{one two}).send_log
     end
 
-    [:file, :line, :version].each do |attr|
+    [:file, :line].each do |attr|
       it "should pass the #{attr}" do
         Puppet::Util::Log.expects(:new).with { |args| args[attr] == "my val" }
         Puppet::Transaction::Event.new(attr => "my val").send_log
diff --git a/spec/unit/type_spec.rb b/spec/unit/type_spec.rb
index 48b00ec..7416064 100755
--- a/spec/unit/type_spec.rb
+++ b/spec/unit/type_spec.rb
@@ -116,7 +116,7 @@ describe Puppet::Type do
     catalog.version = 50
     catalog.add_resource resource
 
-    resource.source_descriptors.should == {:version=>50, :tags=>["mount", 
"foo"], :path=>"/Mount[foo]"}
+    resource.source_descriptors.should == {:tags=>["mount", "foo"], 
:path=>"/Mount[foo]"}
   end
 
   it "should consider its type to be the name of its class" do
diff --git a/spec/unit/util/log_spec.rb b/spec/unit/util/log_spec.rb
index 7d96fe1..f3fd1b0 100755
--- a/spec/unit/util/log_spec.rb
+++ b/spec/unit/util/log_spec.rb
@@ -120,7 +120,7 @@ describe Puppet::Util::Log do
       Puppet::Util::Log.new(:level => "notice", :message => :foo, :source => 
"foo")
     end
 
-    [:file, :line, :version].each do |attr|
+    [:file, :line].each do |attr|
       it "should use #{attr} if provided" do
         Puppet::Util::Log.any_instance.expects(attr.to_s + "=").with "foo"
         Puppet::Util::Log.new(:level => "notice", :message => :foo, attr => 
"foo")
@@ -177,23 +177,12 @@ describe Puppet::Util::Log do
         log = Puppet::Util::Log.new(:level => "notice", :message => :foo)
         log.expects(:tag).with("tag")
         log.expects(:tag).with("tag2")
-        log.expects(:version=).with(100)
 
         log.source = source
 
         log.source.should == "path"
       end
 
-      it "should copy over any version information" do
-        catalog = Puppet::Resource::Catalog.new
-        catalog.version = 25
-        source = Puppet::Type.type(:file).new :path => "/foo/bar"
-        catalog.add_resource source
-
-        log = Puppet::Util::Log.new(:level => "notice", :message => :foo, 
:source => source)
-        log.version.should == 25
-      end
-
       it "should copy over any file and line information" do
         source = Puppet::Type.type(:file).new :path => "/foo/bar"
         source.file = "/my/file"
@@ -212,4 +201,22 @@ describe Puppet::Util::Log do
       end
     end
   end
+
+  describe "to_yaml" do
+    it "should not include the @version attribute" do
+      log = Puppet::Util::Log.new(:level => "notice", :message => :foo, 
:version => 100)
+      log.to_yaml_properties.should_not include('@version')
+    end
+
+    it "should include attributes @level, @message, @source, @tags, and @time" 
do
+      log = Puppet::Util::Log.new(:level => "notice", :message => :foo, 
:version => 100)
+      log.to_yaml_properties.should == %...@level @message @source @tags @time}
+    end
+
+    it "should include attributes @file and @line if specified" do
+      log = Puppet::Util::Log.new(:level => "notice", :message => :foo, :file 
=> "foo", :line => 35)
+      log.to_yaml_properties.should include('@file')
+      log.to_yaml_properties.should include('@line')
+    end
+  end
 end
diff --git a/spec/unit/util/logging_spec.rb b/spec/unit/util/logging_spec.rb
index 46ae538..411cd17 100755
--- a/spec/unit/util/logging_spec.rb
+++ b/spec/unit/util/logging_spec.rb
@@ -81,7 +81,7 @@ describe Puppet::Util::Logging do
       @logger.notice ["foo", "bar", "baz"]
     end
 
-    [:file, :line, :version, :tags].each do |attr|
+    [:file, :line, :tags].each do |attr|
       it "should include #{attr} if available" do
         @logger.singleton_class.send(:attr_accessor, attr)
 
-- 
1.7.2

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to