summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrice Figureau <brice-puppet@daysofwonder.com>2010-07-17 17:25:04 +0200
committerMarkus Roberts <Markus@reality.com>2010-07-18 19:44:08 -0700
commit6e07a199011b434ea6d7b3c69d14e6ca7cf9cf8e (patch)
treeb4fcf70fec6ea861b8134584a2c6dd804bb6aa84
parent5b68afe0be7abd4f6743c4ad05513b6879f40153 (diff)
downloadpuppet-6e07a199011b434ea6d7b3c69d14e6ca7cf9cf8e.tar.gz
puppet-6e07a199011b434ea6d7b3c69d14e6ca7cf9cf8e.tar.xz
puppet-6e07a199011b434ea6d7b3c69d14e6ca7cf9cf8e.zip
Fix #4262 - Puppetmaster used to log compilation time
It looks like a merge went wrong and we were returning abruptely from a benchmark block, thus jumping over a precious log information. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
-rw-r--r--lib/puppet/indirector/catalog/compiler.rb4
-rwxr-xr-xspec/unit/indirector/catalog/compiler_spec.rb10
2 files changed, 12 insertions, 2 deletions
diff --git a/lib/puppet/indirector/catalog/compiler.rb b/lib/puppet/indirector/catalog/compiler.rb
index e85608ed1..c50022fff 100644
--- a/lib/puppet/indirector/catalog/compiler.rb
+++ b/lib/puppet/indirector/catalog/compiler.rb
@@ -72,9 +72,9 @@ class Puppet::Resource::Catalog::Compiler < Puppet::Indirector::Code
loglevel = networked? ? :notice : :none
- benchmark(loglevel, "Compiled catalog for #{node.name}") do
+ benchmark(loglevel, str) do
begin
- return Puppet::Parser::Compiler.compile(node)
+ config = Puppet::Parser::Compiler.compile(node)
rescue Puppet::Error => detail
Puppet.err(detail.to_s) if networked?
raise
diff --git a/spec/unit/indirector/catalog/compiler_spec.rb b/spec/unit/indirector/catalog/compiler_spec.rb
index 755509f53..2ae5f6ff3 100755
--- a/spec/unit/indirector/catalog/compiler_spec.rb
+++ b/spec/unit/indirector/catalog/compiler_spec.rb
@@ -137,6 +137,16 @@ describe Puppet::Resource::Catalog::Compiler do
Puppet::Parser::Compiler.stubs(:compile)
@compiler.find(@request)
end
+
+ it "should log the benchmark result" do
+ Puppet::Node.stubs(:find).returns(@node)
+ @compiler.stubs(:networked?).returns(true)
+ Puppet::Parser::Compiler.stubs(:compile)
+
+ Puppet.expects(:notice).with { |msg| msg =~ /Compiled catalog/ }
+
+ @compiler.find(@request)
+ end
end
describe "when extracting facts from the request" do