Class: Puppet::Application::Cert
- Inherits:
-
Puppet::Application
- Object
- Puppet::Application
- Puppet::Application::Cert
- Defined in:
- lib/puppet/application/cert.rb
Constant Summary
Constants inherited from Puppet::Application
Instance Attribute Summary collapse
-
#all ⇒ Object
Returns the value of attribute all.
-
#ca ⇒ Object
Returns the value of attribute ca.
-
#digest ⇒ Object
Returns the value of attribute digest.
-
#signed ⇒ Object
Returns the value of attribute signed.
Attributes inherited from Puppet::Application
Instance Method Summary collapse
- #main ⇒ Object
- #parse_options ⇒ Object
- #setup ⇒ Object
- #subcommand ⇒ Object
- #subcommand=(name) ⇒ Object
Methods inherited from Puppet::Application
[], banner, clear!, clear?, controlled_run, exit, find, #handlearg, #help, #initialize, interrupted?, #name, option, option_parser_commands, #preinit, restart!, restart_requested?, #run, #run_command, run_mode, #set_run_mode, should_not_parse_config, should_parse_config, #should_parse_config?, should_parse_config?, stop!, stop_requested?
Methods included from Util
activerecord_version, benchmark, chuser, classproxy, #execfail, #execpipe, execute, logmethods, memory, proxy, recmkdir, secure_open, symbolize, symbolizehash, symbolizehash!, synchronize_on, thinmark, #threadlock, which, withumask
Methods included from Util::POSIX
#get_posix_field, #gid, #idfield, #methodbyid, #methodbyname, #search_posix_field, #uid
Constructor Details
This class inherits a constructor from Puppet::Application
Instance Attribute Details
#all ⇒ Object
Returns the value of attribute all.
8 9 10 |
# File 'lib/puppet/application/cert.rb', line 8 def all @all end |
#ca ⇒ Object
Returns the value of attribute ca.
8 9 10 |
# File 'lib/puppet/application/cert.rb', line 8 def ca @ca end |
#digest ⇒ Object
Returns the value of attribute digest.
8 9 10 |
# File 'lib/puppet/application/cert.rb', line 8 def digest @digest end |
#signed ⇒ Object
Returns the value of attribute signed.
8 9 10 |
# File 'lib/puppet/application/cert.rb', line 8 def signed @signed end |
Instance Method Details
#main ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/puppet/application/cert.rb', line 50 def main if @all hosts = :all elsif @signed hosts = :signed else hosts = command_line.args.collect { |h| h.downcase } end begin @ca.apply(:revoke, :to => hosts) if subcommand == :destroy @ca.apply(subcommand, :to => hosts, :digest => @digest) rescue => detail puts detail.backtrace if Puppet[:trace] puts detail.to_s exit(24) end end |
#parse_options ⇒ Object
89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/puppet/application/cert.rb', line 89 def # handle the bareword subcommand pattern. result = super unless self.subcommand then if sub = self.command_line.args.shift then self.subcommand = sub else help end end result end |
#setup ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/puppet/application/cert.rb', line 68 def setup require 'puppet/ssl/certificate_authority' exit(Puppet.settings.print_configs ? 0 : 1) if Puppet.settings.print_configs? Puppet::Util::Log.newdestination :console if [:generate, :destroy].include? subcommand Puppet::SSL::Host.ca_location = :local else Puppet::SSL::Host.ca_location = :only end begin @ca = Puppet::SSL::CertificateAuthority.new rescue => detail puts detail.backtrace if Puppet[:trace] puts detail.to_s exit(23) end end |
#subcommand ⇒ Object
10 11 12 |
# File 'lib/puppet/application/cert.rb', line 10 def subcommand @subcommand end |
#subcommand=(name) ⇒ Object
13 14 15 16 17 |
# File 'lib/puppet/application/cert.rb', line 13 def subcommand=(name) # Handle the nasty, legacy mapping of "clean" to "destroy". sub = name.to_sym @subcommand = (sub == :clean ? :destroy : sub) end |