summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-04-19 14:59:11 -0500
committerLuke Kanies <luke@madstop.com>2008-04-19 14:59:11 -0500
commitd4813f1e03d96551e91b104e48b028fb4074d398 (patch)
tree535b8ebeadc42be7e3d1bcc8679c1790a341ec19 /lib/puppet
parent809fc77bc767fb3acabc83d55183686200b1e384 (diff)
downloadpuppet-d4813f1e03d96551e91b104e48b028fb4074d398.tar.gz
puppet-d4813f1e03d96551e91b104e48b028fb4074d398.tar.xz
puppet-d4813f1e03d96551e91b104e48b028fb4074d398.zip
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.
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/ssl/certificate_authority.rb14
1 files changed, 14 insertions, 0 deletions
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