diff options
author | Brice Figureau <brice-puppet@daysofwonder.com> | 2009-02-14 16:16:57 +0100 |
---|---|---|
committer | Brice Figureau <brice-puppet@daysofwonder.com> | 2009-02-16 20:12:10 +0100 |
commit | 9b9e5e895bef9e59f7d592d6eb687ab1f683c117 (patch) | |
tree | 17035f55ee17c1d4a3370d12ce19dac9e65e4cce /bin | |
parent | 97e716a97de81bb31b665c70489ee1657ddc5424 (diff) | |
download | puppet-9b9e5e895bef9e59f7d592d6eb687ab1f683c117.tar.gz |
Move puppetca to the Application Controller paradigm
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/puppetca | 103 |
1 files changed, 2 insertions, 101 deletions
diff --git a/bin/puppetca b/bin/puppetca index 81e14396e..771e31b71 100755 --- a/bin/puppetca +++ b/bin/puppetca @@ -96,104 +96,5 @@ # Copyright (c) 2005 Reductive Labs, LLC # Licensed under the GNU Public License -require 'puppet' -require 'puppet/ssl/certificate_authority' -require 'getoptlong' - -options = [ - [ "--all", "-a", GetoptLong::NO_ARGUMENT ], - [ "--clean", "-c", GetoptLong::NO_ARGUMENT ], - [ "--debug", "-d", GetoptLong::NO_ARGUMENT ], - [ "--generate", "-g", GetoptLong::NO_ARGUMENT ], - [ "--help", "-h", GetoptLong::NO_ARGUMENT ], - [ "--list", "-l", GetoptLong::NO_ARGUMENT ], - [ "--print", "-p", GetoptLong::NO_ARGUMENT ], - [ "--revoke", "-r", GetoptLong::NO_ARGUMENT ], - [ "--sign", "-s", GetoptLong::NO_ARGUMENT ], - [ "--verify", GetoptLong::NO_ARGUMENT ], - [ "--version", "-V", GetoptLong::NO_ARGUMENT ], - [ "--verbose", "-v", GetoptLong::NO_ARGUMENT ] -] - -# Add all of the config parameters as valid options. -Puppet.settings.addargs(options) - -result = GetoptLong.new(*options) - -modes = Puppet::SSL::CertificateAuthority::Interface::INTERFACE_METHODS - -all = false -mode = nil - -begin - result.each { |opt,arg| - case opt - when "--clean" - mode = :destroy - when "--all" - all = true - when "--debug" - Puppet::Util::Log.level = :debug - when "--help" - if Puppet.features.usage? - RDoc::usage && exit - else - puts "No help available unless you have RDoc::usage installed" - exit - end - when "--version" - puts "%s" % Puppet.version - exit - when "--verbose" - Puppet::Util::Log.level = :info - else - tmp = opt.sub("--", '').to_sym - if modes.include?(tmp) - mode = tmp - else - Puppet.settings.handlearg(opt, arg) - end - end - } -rescue GetoptLong::InvalidOption => detail - $stderr.puts "Try '#{$0} --help'" - exit(1) -end - -# Now parse the config -Puppet.parse_config - -if Puppet.settings.print_configs? - exit(Puppet.settings.print_configs ? 0 : 1) -end - -Puppet::Util::Log.newdestination :console - -Puppet::SSL::Host.ca_location = :local - -begin - ca = Puppet::SSL::CertificateAuthority.new -rescue => detail - puts detail.backtrace if Puppet[:trace] - puts detail.to_s - exit(23) -end - -unless mode - $stderr.puts "You must specify a mode; see the output from --help" - exit(12) -end - -if all - hosts = :all -else - hosts = ARGV.collect { |h| h.downcase } -end - -begin - ca.apply(mode, :to => hosts) -rescue => detail - puts detail.backtrace if Puppet[:trace] - puts detail.to_s - exit(24) -end +require 'puppet/application/puppetca' +Puppet::Application[:puppetca].run
\ No newline at end of file |