[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, experimental, updated. debian/2.6.8-1-844-g7ec39d5

Richard Crowley r at rcrowley.org
Tue May 10 08:07:28 UTC 2011


The following commit has been merged in the experimental branch:
commit 961c7163f336c0dd96f7f72122af9155e1a2260a
Author: Richard Crowley <r at rcrowley.org>
Date:   Wed Mar 23 17:45:46 2011 +0000

    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.

diff --git a/lib/puppet/application/certificate.rb b/lib/puppet/application/certificate.rb
index 48736fc..f4b13ff 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 4088a45..5c06cdc 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

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list