diff options
-rw-r--r-- | CHANGELOG | 2 | ||||
-rw-r--r-- | lib/puppet/util/log.rb | 17 | ||||
-rwxr-xr-x | spec/unit/util/log.rb | 46 |
3 files changed, 3 insertions, 62 deletions
@@ -1,4 +1,6 @@ 0.24.x + Fixed #1698 - All logs should now show up in the reports + Fixed #1661 - Type reference: tidy should specify manditory parameters Fixed #1104 - Classes and nodes should set $name variables diff --git a/lib/puppet/util/log.rb b/lib/puppet/util/log.rb index 0dfd36dfa..b57faad42 100644 --- a/lib/puppet/util/log.rb +++ b/lib/puppet/util/log.rb @@ -369,11 +369,7 @@ class Puppet::Util::Log end def handle(msg) - # Only add messages from objects, since anything else is - # probably unrelated to this run. - if msg.objectsource? - @report.newlog(msg) - end + @report.newlog(msg) end end @@ -505,15 +501,6 @@ class Puppet::Util::Log Log.newmessage(self) end - # Was the source of this log a Puppet resource or parameter? - def objectsource? - if defined? @objectsource and @objectsource - @objectsource - else - false - end - end - # 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) @@ -521,10 +508,8 @@ 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) - @objectsource = true @source = source.path else - @objectsource = false @source = source.to_s end if source.respond_to?(:tags) diff --git a/spec/unit/util/log.rb b/spec/unit/util/log.rb index aa00602a9..c42b25c74 100755 --- a/spec/unit/util/log.rb +++ b/spec/unit/util/log.rb @@ -103,51 +103,5 @@ describe Puppet::Util::Log do report.should be_include(log.source) report.should be_include(log.time.to_s) end - - it "should have a method for indicating whether it was created by a resource" do - Puppet::Util::Log.new(:level => "notice", :message => :foo).should respond_to(:objectsource?) - end - - describe "when setting a source" do - it "should mark itself as from a Puppet resource if its source is a Puppet resource" do - file = Puppet::Type.type(:file).create :path => "/testing/object/source/in/logs" - Puppet::Util::Log.new(:level => "notice", :message => :foo, :source => file).should be_objectsource - end - - it "should use the resource's path when its source is a resource" do - # Use a different path, so we don't use 'clear', which is deprecated in master - file = Puppet::Type.type(:file).create :path => "/testing/object/source/in/logs/with/path" - file.expects(:path).returns "mypath" - Puppet::Util::Log.new(:level => "notice", :message => :foo, :source => file).source.should == "mypath" - end - - it "should mark itself as from a Puppet resource if its source is a Puppet parameter" do - file = Puppet::Type.type(:file).create :path => "/testing/object/source/in/logs/with/parameters", :mode => "500" - mode = file.property(:mode) - Puppet::Util::Log.new(:level => "notice", :message => :foo, :source => mode).should be_objectsource - end - - it "should use the resource's path when its source is a Puppet parameter" do - # Use a different path, so we don't use 'clear', which is deprecated in master - file = Puppet::Type.type(:file).create :path => "/testing/object/source/in/logs/with/path/in/parameters", :mode => "500" - mode = file.property(:mode) - mode.expects(:path).returns "mypath" - Puppet::Util::Log.new(:level => "notice", :message => :foo, :source => mode).source.should == "mypath" - end - - it "should acquire its source's tags if its source has any" do - file = Puppet::Type.type(:file).create :path => "/testing/object/source/in/logs/with/tags" - file.tag("foo") - file.tag("bar") - log = Puppet::Util::Log.new(:level => "notice", :message => :foo, :source => file) - - log.should be_tagged("foo") - log.should be_tagged("bar") - end - - it "should not set objectsource if the source is not a Parameter or Resource" do - Puppet::Util::Log.new(:level => "notice", :message => :foo, :source => "mysource").should_not be_objectsource - end - end end end |