From d4813f1e03d96551e91b104e48b028fb4074d398 Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Sat, 19 Apr 2008 14:59:11 -0500 Subject: Adding the last functionality needed for puppetca to use the Indirector. This commit adds 'list' and 'print' support to the CA. They're mostly delegator methods, but now the CA should be the sole interface for puppetca. --- lib/puppet/ssl/certificate_authority.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lib/puppet') diff --git a/lib/puppet/ssl/certificate_authority.rb b/lib/puppet/ssl/certificate_authority.rb index 62e799ef6..2399c7204 100644 --- a/lib/puppet/ssl/certificate_authority.rb +++ b/lib/puppet/ssl/certificate_authority.rb @@ -96,6 +96,11 @@ class Puppet::SSL::CertificateAuthority return pass end + # List all signed certificates. + def list + Puppet::SSL::Certificate.search("*").collect { |c| c.name } + end + # Read the next serial from the serial file, and increment the # file so this one is considered used. def next_serial @@ -119,6 +124,15 @@ class Puppet::SSL::CertificateAuthority FileTest.exist? Puppet[:capass] end + # Print a given host's certificate as text. + def print(name) + if cert = Puppet::SSL::Certificate.find(name) + return cert.to_text + else + return nil + end + end + # Revoke a given certificate. def revoke(name) raise ArgumentError, "Cannot revoke certificates when the CRL is disabled" unless crl -- cgit