diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-09-15 17:32:26 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-09-15 17:32:26 +0000 |
| commit | 48992d712bc6d226d117bebd887c0fd42816fc3a (patch) | |
| tree | a799c010936ae97bdce222d72dfe31790aef4357 /lib | |
| parent | cda7253b2da3b6980f5cf2846f631597ef249000 (diff) | |
| download | puppet-48992d712bc6d226d117bebd887c0fd42816fc3a.tar.gz puppet-48992d712bc6d226d117bebd887c0fd42816fc3a.tar.xz puppet-48992d712bc6d226d117bebd887c0fd42816fc3a.zip | |
Using the "trace" configuration parameter to determine whether a stack trace should be printed, rather than just using "debug". I added the param a little while ago and was using it internally in Puppet::DevError, but I just now went through the whole configuration and switched to using it.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1613 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib')
27 files changed, 37 insertions, 51 deletions
diff --git a/lib/puppet/autoload.rb b/lib/puppet/autoload.rb index 0a2b7b6b5..7e880b922 100644 --- a/lib/puppet/autoload.rb +++ b/lib/puppet/autoload.rb @@ -80,9 +80,9 @@ class Puppet::Autoload Kernel.load file, @wrap @loaded[name] = true rescue => detail - #if Puppet[:debug] - # puts detail.backtrace - #end + if Puppet[:trace] + puts detail.backtrace + end warn "Could not autoload %s: %s" % [file.inspect, detail] end end diff --git a/lib/puppet/client.rb b/lib/puppet/client.rb index d8cc7ecff..4f2718b7d 100644 --- a/lib/puppet/client.rb +++ b/lib/puppet/client.rb @@ -121,7 +121,7 @@ module Puppet self.run self.lastrun = Time.now.to_i rescue => detail - if Puppet[:debug] + if Puppet[:trace] puts detail.backtrace end Puppet.err "Could not run %s: %s" % [self.class, detail] diff --git a/lib/puppet/client/master.rb b/lib/puppet/client/master.rb index 19d301f7d..a8e83c0df 100644 --- a/lib/puppet/client/master.rb +++ b/lib/puppet/client/master.rb @@ -119,7 +119,7 @@ class Puppet::Client::MasterClient < Puppet::Client detail rescue => detail Puppet.err "Found a bug: %s" % detail - if Puppet[:debug] + if Puppet[:trace] puts detail.backtrace end ensure diff --git a/lib/puppet/config.rb b/lib/puppet/config.rb index 2817ce612..cc6383fc9 100644 --- a/lib/puppet/config.rb +++ b/lib/puppet/config.rb @@ -85,7 +85,9 @@ class Config trans.evaluate comp.remove rescue => detail + if Puppet[:trace] puts detail.backtrace + end Puppet.err "Could not configure myself: %s" % detail end end diff --git a/lib/puppet/daemon.rb b/lib/puppet/daemon.rb index a19124545..cd356e6cc 100755 --- a/lib/puppet/daemon.rb +++ b/lib/puppet/daemon.rb @@ -205,7 +205,7 @@ module Puppet begin cert, cacert = caclient.getcert(@csr.to_pem) rescue => detail - if Puppet[:debug] + if Puppet[:trace] puts detail.backtrace end raise Puppet::Error.new("Certificate retrieval failed: %s" % diff --git a/lib/puppet/filetype.rb b/lib/puppet/filetype.rb index c70daafb3..081448f33 100755 --- a/lib/puppet/filetype.rb +++ b/lib/puppet/filetype.rb @@ -36,7 +36,7 @@ module Puppet rescue Puppet::Error => detail raise rescue => detail - if Puppet[:debug] + if Puppet[:trace] puts detail.backtrace end raise Puppet::Error, "%s could not read %s: %s" % diff --git a/lib/puppet/log.rb b/lib/puppet/log.rb index a56e28e2e..7a08ba57d 100644 --- a/lib/puppet/log.rb +++ b/lib/puppet/log.rb @@ -322,7 +322,7 @@ module Puppet # Add the hostname to the source @driver.addlog(tmp) rescue => detail - if Puppet[:debug] + if Puppet[:trace] puts detail.backtrace end Puppet.err detail diff --git a/lib/puppet/networkclient.rb b/lib/puppet/networkclient.rb index ec9323f2c..f093292f2 100644 --- a/lib/puppet/networkclient.rb +++ b/lib/puppet/networkclient.rb @@ -86,7 +86,7 @@ module Puppet Puppet.err "Could not call %s.%s: %s" % [namespace, method, detail.inspect] #raise NetworkClientError.new(detail.to_s) - if Puppet[:debug] + if Puppet[:trace] puts detail.backtrace end raise diff --git a/lib/puppet/parameter.rb b/lib/puppet/parameter.rb index e03653057..d96d290b2 100644 --- a/lib/puppet/parameter.rb +++ b/lib/puppet/parameter.rb @@ -94,11 +94,8 @@ module Puppet Puppet.debug "Reraising %s" % detail raise rescue => detail - if Puppet[:debug] - puts detail.backtrace - end raise Puppet::DevError, "Munging failed for class %s: %s" % - [self.name, detail] + [self.name, detail], detail.backtrace end end #@munger = block @@ -152,12 +149,9 @@ module Puppet rescue ArgumentError, Puppet::Error, TypeError raise rescue => detail - if Puppet[:debug] - puts detail.backtrace - end raise Puppet::DevError, "Validate method failed for class %s: %s" % - [self.name, detail] + [self.name, detail], detail.backtrace end end end diff --git a/lib/puppet/parser/ast.rb b/lib/puppet/parser/ast.rb index a4375a476..ccde7928b 100644 --- a/lib/puppet/parser/ast.rb +++ b/lib/puppet/parser/ast.rb @@ -70,9 +70,6 @@ module Puppet except.file ||= @file raise rescue => detail - #if Puppet[:debug] - # puts detail.backtrace - #end error = Puppet::DevError.new( "Child of type %s failed with error %s: %s" % [self.class, detail.class, detail.to_s] diff --git a/lib/puppet/parser/ast/classdef.rb b/lib/puppet/parser/ast/classdef.rb index 336cf0189..e09db985f 100644 --- a/lib/puppet/parser/ast/classdef.rb +++ b/lib/puppet/parser/ast/classdef.rb @@ -52,7 +52,7 @@ class Puppet::Parser::AST error = Puppet::ParseError.new(detail) error.line = self.line error.file = self.file - error.backtrace = detail.backtrace + error.set_backtrace detail.backtrace raise error end end diff --git a/lib/puppet/parser/ast/compdef.rb b/lib/puppet/parser/ast/compdef.rb index b6cd6491f..17ee60181 100644 --- a/lib/puppet/parser/ast/compdef.rb +++ b/lib/puppet/parser/ast/compdef.rb @@ -54,7 +54,7 @@ class Puppet::Parser::AST error = Puppet::ParseError.new(detail) error.line = self.line error.file = self.file - error.backtrace = detail.backtrace + error.set_backtrace detail.backtrace raise error end end diff --git a/lib/puppet/parser/ast/component.rb b/lib/puppet/parser/ast/component.rb index 2621c76ad..ebbf21959 100644 --- a/lib/puppet/parser/ast/component.rb +++ b/lib/puppet/parser/ast/component.rb @@ -97,7 +97,7 @@ class Puppet::Parser::AST error = Puppet::ParseError.new(except.message) error.line = self.line error.file = self.file - error.backtrace = except.backtrace + error.set_backtrace except.backtrace raise error end } diff --git a/lib/puppet/parser/ast/leaf.rb b/lib/puppet/parser/ast/leaf.rb index 82302083d..7b9a283d7 100644 --- a/lib/puppet/parser/ast/leaf.rb +++ b/lib/puppet/parser/ast/leaf.rb @@ -97,7 +97,7 @@ class Puppet::Parser::AST error = Puppet::DevError.new(detail) error.line = self.line error.file = self.file - error.backtrace = detail.backtrace + error.set_backtrace detail.backtrace raise error end end diff --git a/lib/puppet/parser/ast/objectdef.rb b/lib/puppet/parser/ast/objectdef.rb index cdcbd1aca..ac5fe3070 100644 --- a/lib/puppet/parser/ast/objectdef.rb +++ b/lib/puppet/parser/ast/objectdef.rb @@ -59,7 +59,7 @@ class Puppet::Parser::AST error = Puppet::ParseError.new(detail) error.line = self.line error.file = self.file - error.backtrace = detail.backtrace + error.set_backtrace detail.backtrace raise error end @@ -138,7 +138,7 @@ class Puppet::Parser::AST error = Puppet::ParseError.new(detail) error.line = self.line error.file = self.file - error.backtrace = detail.backtrace + error.set_backtrace detail.backtrace raise error end }.reject { |obj| obj.nil? } @@ -294,7 +294,7 @@ class Puppet::Parser::AST error = Puppet::DevError.new( "failed to tree a %s" % self.class ) - error.backtrace = detail.backtrace + error.set_backtrace detail.backtrace raise error end }.join("\n") diff --git a/lib/puppet/parser/ast/objectref.rb b/lib/puppet/parser/ast/objectref.rb index 12e36360f..f9a63e222 100644 --- a/lib/puppet/parser/ast/objectref.rb +++ b/lib/puppet/parser/ast/objectref.rb @@ -33,7 +33,7 @@ class Puppet::Parser::AST error = Puppet::ParseError.new(detail) error.line = self.line error.file = self.file - error.backtrace = detail.backtrace + error.set_backtrace detail.backtrace raise error end diff --git a/lib/puppet/parser/ast/typedefaults.rb b/lib/puppet/parser/ast/typedefaults.rb index e6ffe7080..2e11a1b94 100644 --- a/lib/puppet/parser/ast/typedefaults.rb +++ b/lib/puppet/parser/ast/typedefaults.rb @@ -25,7 +25,7 @@ class Puppet::Parser::AST error = Puppet::ParseError.new(detail) error.line = self.line error.file = self.file - error.backtrace = detail.backtrace + error.set_backtrace detail.backtrace raise error end end diff --git a/lib/puppet/parser/ast/vardef.rb b/lib/puppet/parser/ast/vardef.rb index 4b1eb90d2..79129f31a 100644 --- a/lib/puppet/parser/ast/vardef.rb +++ b/lib/puppet/parser/ast/vardef.rb @@ -20,7 +20,7 @@ class Puppet::Parser::AST error = Puppet::ParseError.new(detail) error.line = self.line error.file = self.file - error.backtrace = detail.backtrace + error.set_backtrace detail.backtrace raise error end end diff --git a/lib/puppet/parser/grammar.ra b/lib/puppet/parser/grammar.ra index c4883deef..623ca0cab 100644 --- a/lib/puppet/parser/grammar.ra +++ b/lib/puppet/parser/grammar.ra @@ -695,7 +695,7 @@ def parse(string = nil) error = Puppet::ParseError.new(except) error.line = @lexer.line error.file = @lexer.file - error.backtrace = except.backtrace + error.set_backtrace except.backtrace raise error rescue Puppet::ParseError => except except.line ||= @lexer.line @@ -720,7 +720,7 @@ def parse(string = nil) error = Puppet::DevError.new(except.message) error.line = @lexer.line error.file = @lexer.file - error.backtrace = except.backtrace + error.set_backtrace except.backtrace #if Puppet[:debug] # puts caller #end diff --git a/lib/puppet/parser/interpreter.rb b/lib/puppet/parser/interpreter.rb index 19d61c276..ad30e6ed3 100644 --- a/lib/puppet/parser/interpreter.rb +++ b/lib/puppet/parser/interpreter.rb @@ -326,10 +326,7 @@ module Puppet rescue => except error = Puppet::DevError.new("%s: %s" % [except.class, except.message]) - error.backtrace = except.backtrace - #if Puppet[:debug] - # puts except.backtrace - #end + error.set_backtrace except.backtrace raise error end diff --git a/lib/puppet/parser/parser.rb b/lib/puppet/parser/parser.rb index 85a958761..41c119c2c 100644 --- a/lib/puppet/parser/parser.rb +++ b/lib/puppet/parser/parser.rb @@ -29,7 +29,7 @@ module Puppet class Parser < Racc::Parser -module_eval <<'..end grammar.ra modeval..id7713d53378', 'grammar.ra', 603 +module_eval <<'..end grammar.ra modeval..idab2f060823', 'grammar.ra', 603 require 'puppet/parser/functions' attr_reader :file @@ -125,7 +125,7 @@ def parse(string = nil) error = Puppet::ParseError.new(except) error.line = @lexer.line error.file = @lexer.file - error.backtrace = except.backtrace + error.set_backtrace except.backtrace raise error rescue Puppet::ParseError => except except.line ||= @lexer.line @@ -150,7 +150,7 @@ def parse(string = nil) error = Puppet::DevError.new(except.message) error.line = @lexer.line error.file = @lexer.file - error.backtrace = except.backtrace + error.set_backtrace except.backtrace #if Puppet[:debug] # puts caller #end @@ -175,7 +175,7 @@ end # $Id$ -..end grammar.ra modeval..id7713d53378 +..end grammar.ra modeval..idab2f060823 ##### racc 1.4.5 generates ### diff --git a/lib/puppet/rails.rb b/lib/puppet/rails.rb index 8b2a2f99d..a547fff5f 100644 --- a/lib/puppet/rails.rb +++ b/lib/puppet/rails.rb @@ -98,7 +98,7 @@ module Puppet::Rails begin Puppet::Rails::Database.up rescue => detail - if Puppet[:debug] + if Puppet[:trace] puts detail.backtrace end raise Puppet::Error, "Could not initialize database: %s" % detail diff --git a/lib/puppet/reports/tagmail.rb b/lib/puppet/reports/tagmail.rb index 4a53e2f3a..ba929b7fc 100644 --- a/lib/puppet/reports/tagmail.rb +++ b/lib/puppet/reports/tagmail.rb @@ -70,7 +70,7 @@ Puppet::Server::Report.newreport(:tagmail) do |report| end end rescue => detail - if Puppet[:debug] + if Puppet[:trace] puts detail.backtrace end raise Puppet::Error, diff --git a/lib/puppet/server/report.rb b/lib/puppet/server/report.rb index d6ed706f9..1c217561f 100755 --- a/lib/puppet/server/report.rb +++ b/lib/puppet/server/report.rb @@ -114,7 +114,7 @@ class Server f.puts report end rescue => detail - if Puppet[:debug] + if Puppet[:trace] puts detail.backtrace end Puppet.warning "Could not write report for %s at %s: %s" % diff --git a/lib/puppet/server/servlet.rb b/lib/puppet/server/servlet.rb index 8fc872293..136bbb933 100644 --- a/lib/puppet/server/servlet.rb +++ b/lib/puppet/server/servlet.rb @@ -43,7 +43,6 @@ class Server end ip = request.peeraddr[3] if request.client_cert - begin if @puppetserver.authconfig.exists? allowed = @puppetserver.authconfig.allowed?(method, client, ip) @@ -71,11 +70,6 @@ class Server return false end end - rescue => detail - puts detail - puts detail.backtrace - raise - end else if method =~ /^puppetca\./ Puppet.notice "Allowing %s(%s) untrusted access to CA methods" % diff --git a/lib/puppet/transaction.rb b/lib/puppet/transaction.rb index b9a9376e8..66d691d97 100644 --- a/lib/puppet/transaction.rb +++ b/lib/puppet/transaction.rb @@ -45,7 +45,7 @@ class Transaction begin changes = child.evaluate rescue => detail - if Puppet[:debug] + if Puppet[:trace] puts detail.backtrace end diff --git a/lib/puppet/type/pfile.rb b/lib/puppet/type/pfile.rb index 714fbda5f..86b608c07 100644 --- a/lib/puppet/type/pfile.rb +++ b/lib/puppet/type/pfile.rb @@ -314,7 +314,9 @@ module Puppet begin File.unlink(newfile) rescue => detail - puts detail.backtrace + if Puppet[:trace] + puts detail.backtrace + end self.err "Could not remove old backup: %s" % detail return false |
