diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-08-28 05:59:40 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-08-28 05:59:40 +0000 |
commit | 628896b49e0ebc396604c0725aab7b9d372c7016 (patch) | |
tree | bb505d7e9287d2cadc2b07eab8a5b54adad523fd /lib/puppet.rb | |
parent | 9f7621b04acd7ed4845afd1182e1e6ce13e8fb04 (diff) | |
download | puppet-628896b49e0ebc396604c0725aab7b9d372c7016.tar.gz puppet-628896b49e0ebc396604c0725aab7b9d372c7016.tar.xz puppet-628896b49e0ebc396604c0725aab7b9d372c7016.zip |
Adding a "configprint" option for printing out the local config state
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1496 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet.rb')
-rw-r--r-- | lib/puppet.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/puppet.rb b/lib/puppet.rb index 3688377cd..5102a5ffe 100644 --- a/lib/puppet.rb +++ b/lib/puppet.rb @@ -139,6 +139,11 @@ module Puppet "Whether to just print a manifest to stdout and exit. Only makes sense when used interactively. Takes into account arguments specified on the CLI."], + :configprint => ["", + "Print the value of a specific configuration parameter. If a + parameter is provided for this, then the value is printed and puppet + exits. Comma-separate multiple values. For a list of all values, + specify 'all'."], :color => [true, "Whether to use ANSI colors when logging to the console."], :mkusers => [false, "Whether to create the necessary user and group that puppetd will @@ -246,6 +251,29 @@ module Puppet end def self.genconfig + if Puppet[:configprint] != "" + val = Puppet[:configprint] + if val == "all" + hash = {} + Puppet.config.each do |name, obj| + val = obj.value + case val + when true, false, "": val = val.inspect + end + hash[name] = val + end + hash.sort { |a,b| a[0].to_s <=> b[0].to_s }.each do |name, val| + puts "%s = %s" % [name, val] + end + elsif val =~ /,/ + val.split(/\s*,\s*/).sort.each do |v| + puts "%s = %s" % [v, Puppet[v]] + end + else + puts Puppet[val] + end + exit(0) + end if Puppet[:genconfig] puts Puppet.config.to_config exit(0) |