summaryrefslogtreecommitdiffstats
path: root/lib/puppet/server
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-04-10 22:13:10 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-04-10 22:13:10 +0000
commit201aa023dd279d2d968a97732db11a1933665562 (patch)
treed96aea85ef130b698025771ba3bedcae56f800b4 /lib/puppet/server
parent0507486ad35189c557903d0c78bd1bbd7d43b967 (diff)
downloadpuppet-201aa023dd279d2d968a97732db11a1933665562.tar.gz
puppet-201aa023dd279d2d968a97732db11a1933665562.tar.xz
puppet-201aa023dd279d2d968a97732db11a1933665562.zip
Adding simple benchmarking, and using it in a few of the more obvious places. Also, fixed a bug in Scope#gennode.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1098 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/server')
-rw-r--r--lib/puppet/server/master.rb49
1 files changed, 34 insertions, 15 deletions
diff --git a/lib/puppet/server/master.rb b/lib/puppet/server/master.rb
index 7e719452f..719b115ac 100644
--- a/lib/puppet/server/master.rb
+++ b/lib/puppet/server/master.rb
@@ -9,6 +9,8 @@ module Puppet
class Server
class MasterError < Puppet::Error; end
class Master < Handler
+ include Puppet::Util
+
attr_accessor :ast, :local
attr_reader :ca
@@ -66,8 +68,8 @@ class Server
args[:UseNodes] = false
end
- # This is only used by the cfengine module, or if --loadclasses was specified
- # in +puppet+.
+ # This is only used by the cfengine module, or if --loadclasses was
+ # specified in +puppet+.
if hash.include?(:Classes)
args[:Classes] = hash[:Classes]
end
@@ -113,19 +115,36 @@ class Server
clientip = facts["ipaddress"]
end
- unless @local
- Puppet.notice("Compiling configuration for %s" % client)
- end
- begin
- retobjects = @interpreter.run(client, facts)
- rescue Puppet::Error => detail
- Puppet.err detail
- raise XMLRPC::FaultException.new(
- 1, detail.to_s
- )
- rescue => detail
- Puppet.err detail.to_s
- return ""
+ retobjects = nil
+
+ # This is hackish, but there's no "silence" option for benchmarks
+ # right now
+ if @local
+ begin
+ retobjects = @interpreter.run(client, facts)
+ rescue Puppet::Error => detail
+ Puppet.err detail
+ raise XMLRPC::FaultException.new(
+ 1, detail.to_s
+ )
+ rescue => detail
+ Puppet.err detail.to_s
+ return ""
+ end
+ else
+ benchmark(:notice, "Compiled configuration for %s" % client) do
+ begin
+ retobjects = @interpreter.run(client, facts)
+ rescue Puppet::Error => detail
+ Puppet.err detail
+ raise XMLRPC::FaultException.new(
+ 1, detail.to_s
+ )
+ rescue => detail
+ Puppet.err detail.to_s
+ return ""
+ end
+ end
end
if @local