diff options
author | Luke Kanies <luke@madstop.com> | 2005-06-29 19:44:25 +0000 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2005-06-29 19:44:25 +0000 |
commit | bb7e2833f0ea9c97d55fcb76e5811c035161256f (patch) | |
tree | 560129341856ab4a29d9c3c9a40529627de521e4 /lib/puppet.rb | |
parent | c16ca53ea8d62ffb8e02afddb8ae93cfbae800b2 (diff) | |
download | puppet-bb7e2833f0ea9c97d55fcb76e5811c035161256f.tar.gz puppet-bb7e2833f0ea9c97d55fcb76e5811c035161256f.tar.xz puppet-bb7e2833f0ea9c97d55fcb76e5811c035161256f.zip |
fixing debugging to severely reduce output but allow it when debugging a specific service
git-svn-id: https://reductivelabs.com/svn/puppet/library/trunk@319 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet.rb')
-rw-r--r-- | lib/puppet.rb | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/lib/puppet.rb b/lib/puppet.rb index 40c904e08..56f7ce39e 100644 --- a/lib/puppet.rb +++ b/lib/puppet.rb @@ -18,12 +18,16 @@ module Puppet # the hash that determines how our system behaves @@config = Hash.new(false) - @@config[:puppetroot] = "/var/puppet" - @@config[:rrddir] = "/var/puppet/rrd" @@config[:rrdgraph] = false - @@config[:logdir] = "/var/puppet/log" - @@config[:logfile] = "/var/puppet/log/puppet.log" - @@config[:statefile] = "/var/puppet/log/state" + if Process.uid == 0 + @@config[:puppetroot] = "/var/puppet" + else + @@config[:puppetroot] = File.expand_path("~/.puppet") + end + @@config[:rrddir] = File.join(@@config[:puppetroot],"rrd") + @@config[:logdir] = File.join(@@config[:puppetroot],"log") + @@config[:logfile] = File.join(@@config[:puppetroot],"log/puppet.log") + @@config[:statefile] = File.join(@@config[:puppetroot],"log/state") # handle the different message levels @@ -47,21 +51,33 @@ module Puppet # configuration parameter access and stuff def Puppet.[](param) - return @@config[param] + case param + when :debug: + if Puppet::Log.level == :debug + return true + else + return false + end + when :loglevel: + return Puppet::Log.level + else + return @@config[param] + end end # configuration parameter access and stuff def Puppet.[]=(param,value) - @@config[param] = value case param when :debug: if value - Puppet::Log.level(:debug) + Puppet::Log.level=(:debug) else - Puppet::Log.level(:notice) + Puppet::Log.level=(:notice) end when :loglevel: - Puppet::Log.level(value) + Puppet::Log.level=(value) + else + @@config[param] = value end end |