diff options
| author | Daniel Pittman <daniel@rimspace.net> | 2011-02-03 13:46:08 -0800 |
|---|---|---|
| committer | Daniel Pittman <daniel@rimspace.net> | 2011-02-03 13:46:30 -0800 |
| commit | c912a2af2f63f505a493137d4ff0b88bc3754cda (patch) | |
| tree | 2603d5e7eeeca1daea2ffcc678b0049e877c53f5 /spec | |
| parent | 2a94c61e6c94b1167ea7b858dc184f9f77a7bfc5 (diff) | |
(#4139) hook log autoflush into global defaults
We previously had an ordering dependency in the autoflush option, which was
statically read from defaults when the log destination was configured.
We add a hook in the defaults to update the log subsystem, which in turn
updates log destinations, when autoflush is changed.
This would work as desired:
puppet agent --autoflush --logdest=file
This would not work, as autoflush would be false:
puppet agent --logdest=file --autoflush
Now those changes propagate correctly.
Paired-with: matt@puppetlabs.com
Diffstat (limited to 'spec')
| -rwxr-xr-x | spec/unit/util/log/destinations_spec.rb | 13 | ||||
| -rwxr-xr-x | spec/unit/util/log_spec.rb | 5 |
2 files changed, 18 insertions, 0 deletions
diff --git a/spec/unit/util/log/destinations_spec.rb b/spec/unit/util/log/destinations_spec.rb index 6596c0664..710a51725 100755 --- a/spec/unit/util/log/destinations_spec.rb +++ b/spec/unit/util/log/destinations_spec.rb @@ -22,3 +22,16 @@ describe Puppet::Util::Log.desttypes[:report] do dest.handle "my log" end end + + +describe Puppet::Util::Log.desttypes[:file] do + before do + File.stubs(:open) # prevent actually creating the file + @class = Puppet::Util::Log.desttypes[:file] + end + + it "should default to autoflush false" do + @class.new('/tmp/log').autoflush.should == false + end +end + diff --git a/spec/unit/util/log_spec.rb b/spec/unit/util/log_spec.rb index f3fd1b051..4a30d5086 100755 --- a/spec/unit/util/log_spec.rb +++ b/spec/unit/util/log_spec.rb @@ -136,6 +136,11 @@ describe Puppet::Util::Log do Puppet::Util::Log.new(:level => "notice", :message => :foo) end + it "should update Log autoflush when Puppet[:autoflush] is set" do + Puppet::Util::Log.expects(:autoflush=).once.with(true) + Puppet[:autoflush] = true + end + it "should have a method for determining if a tag is present" do Puppet::Util::Log.new(:level => "notice", :message => :foo).should respond_to(:tagged?) end |
