diff options
| author | Richard Crowley <r@rcrowley.org> | 2011-03-23 17:45:46 +0000 |
|---|---|---|
| committer | Richard Crowley <r@rcrowley.org> | 2011-03-23 17:45:46 +0000 |
| commit | 961c7163f336c0dd96f7f72122af9155e1a2260a (patch) | |
| tree | e1f5d044600492cff56d0de1eda4df1157799b7b /lib | |
| parent | a7a9e125018c7a3fd0f0afc543f7aeaea1c19525 (diff) | |
| download | puppet-961c7163f336c0dd96f7f72122af9155e1a2260a.tar.gz puppet-961c7163f336c0dd96f7f72122af9155e1a2260a.tar.xz puppet-961c7163f336c0dd96f7f72122af9155e1a2260a.zip | |
Added list action.
The common tasks of checking the --ca-location argument and becoming a CA process if necessary (that is, acting like a master) have been abstracted into the Application where they belong.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/puppet/application/certificate.rb | 15 | ||||
| -rw-r--r-- | lib/puppet/interface/certificate.rb | 22 |
2 files changed, 25 insertions, 12 deletions
diff --git a/lib/puppet/application/certificate.rb b/lib/puppet/application/certificate.rb index 48736fc84..f4b13ffe0 100644 --- a/lib/puppet/application/certificate.rb +++ b/lib/puppet/application/certificate.rb @@ -9,4 +9,19 @@ class Puppet::Application::Certificate < Puppet::Application::IndirectionBase Puppet::SSL::Host.ca_location = arg.to_sym end + def setup + + unless Puppet::SSL::Host.ca_location + raise ArgumentError, "You must have a CA location specified; use --ca-location to specify the location (remote, local, only)" + end + + location = Puppet::SSL::Host.ca_location + if location == :local && !Puppet::SSL::CertificateAuthority.ca? + self.class.run_mode("master") + self.set_run_mode self.class.run_mode + end + + super + end + end diff --git a/lib/puppet/interface/certificate.rb b/lib/puppet/interface/certificate.rb index 4088a4557..5c06cdc29 100644 --- a/lib/puppet/interface/certificate.rb +++ b/lib/puppet/interface/certificate.rb @@ -11,21 +11,19 @@ Puppet::Interface::Indirector.interface(:certificate) do end end - action :sign do |name| - invoke do |name| - unless Puppet::SSL::Host.ca_location - raise ArgumentError, "You must have a CA location specified; use --ca-location to specify the location (remote, local, only)" - end - - location = Puppet::SSL::Host.ca_location - if location == :local && !Puppet::SSL::CertificateAuthority.ca? - app = Puppet::Application[:certificate] - app.class.run_mode("master") - app.set_run_mode Puppet::Application[:certificate].class.run_mode + action :list do + invoke do + Puppet::SSL::Host.indirection.search("*").each do |host| + puts host.inspect end + nil + end + end + action :sign do |name| + invoke do |name| Puppet::SSL::Host.indirection.save(Puppet::SSL::Host.new(name)) - end end + end |
