[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 0.25.5-639-g8f94f35
test branch
puppet-dev at googlegroups.com
Wed Jul 14 10:33:31 UTC 2010
The following commit has been merged in the upstream branch:
commit 5988f76aac63c4cb33c3e138c830eaf8aa4abfff
Author: James Turnbull <james at lovedthanlost.net>
Date: Sat Apr 24 03:32:48 2010 +1000
Fixes #3663 - It should be possible to list signed hosts only
Adds a --signed option to the --list feature that only displays signed certificates
diff --git a/lib/puppet/application/cert.rb b/lib/puppet/application/cert.rb
index a4ee5fe..80ccc46 100644
--- a/lib/puppet/application/cert.rb
+++ b/lib/puppet/application/cert.rb
@@ -6,7 +6,7 @@ class Puppet::Application::Cert < Puppet::Application
should_parse_config
- attr_accessor :mode, :all, :ca, :digest
+ attr_accessor :mode, :all, :ca, :digest, :signed
def find_mode(opt)
modes = Puppet::SSL::CertificateAuthority::Interface::INTERFACE_METHODS
@@ -26,6 +26,10 @@ class Puppet::Application::Cert < Puppet::Application
@digest = arg
end
+ option("--signed", "-s") do
+ @signed = true
+ end
+
option("--debug", "-d") do |arg|
Puppet::Util::Log.level = :debug
end
@@ -43,6 +47,8 @@ class Puppet::Application::Cert < Puppet::Application
def main
if @all
hosts = :all
+ elsif @signed
+ hosts = :signed
else
hosts = command_line.args.collect { |h| puts h; h.downcase }
end
diff --git a/lib/puppet/ssl/certificate_authority/interface.rb b/lib/puppet/ssl/certificate_authority/interface.rb
index d2dc7b9..b60834a 100644
--- a/lib/puppet/ssl/certificate_authority/interface.rb
+++ b/lib/puppet/ssl/certificate_authority/interface.rb
@@ -56,6 +56,8 @@ class Puppet::SSL::CertificateAuthority::Interface
if subjects == :all
hosts = [signed, requests].flatten
+ elsif subjects == :signed
+ hosts = signed.flatten
else
hosts = subjects
end
@@ -116,7 +118,7 @@ class Puppet::SSL::CertificateAuthority::Interface
# Set the list of hosts we're operating on. Also supports keywords.
def subjects=(value)
- unless value == :all or value.is_a?(Array)
+ unless value == :all or value == :signed or value.is_a?(Array)
raise ArgumentError, "Subjects must be an array or :all; not %s" % value
end
diff --git a/spec/unit/application/cert.rb b/spec/unit/application/cert.rb
index 5970355..66c6aea 100644
--- a/spec/unit/application/cert.rb
+++ b/spec/unit/application/cert.rb
@@ -55,6 +55,11 @@ describe Puppet::Application::Cert do
@cert_app.all.should be_true
end
+ it "should set signed to true for --signed" do
+ @puppetca.handle_signed(0)
+ @puppetca.signed.should be_true
+ end
+
Puppet::SSL::CertificateAuthority::Interface::INTERFACE_METHODS.reject { |m| m == :destroy }.each do |method|
it "should set mode to #{method} with option --#{method}" do
@cert_app.send("handle_#{method}".to_sym, nil)
diff --git a/spec/unit/ssl/certificate_authority/interface.rb b/spec/unit/ssl/certificate_authority/interface.rb
index bcba298..d38e31b 100755
--- a/spec/unit/ssl/certificate_authority/interface.rb
+++ b/spec/unit/ssl/certificate_authority/interface.rb
@@ -215,6 +215,16 @@ describe Puppet::SSL::CertificateAuthority::Interface do
end
end
+ describe "and :signed was provided" do
+ it "should print a string containing all signed certificate requests and certificates" do
+ @ca.expects(:list).returns %w{host1 host2}
+
+ @applier = @class.new(:list, :signed)
+
+ @applier.apply(@ca)
+ end
+ end
+
describe "and an array of names was provided" do
it "should print a string of all named hosts that have a waiting request" do
@ca.expects(:waiting?).returns %w{host1 host2}
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list