~mathiaz/puppet/reductivelabs-master

« back to all changes in this revision

Viewing changes to lib/puppet/ssl/certificate_authority.rb

  • Committer: Luke Kanies
  • Date: 2008-04-19 19:59:11 UTC
  • Revision ID: git-v1:d4813f1e03d96551e91b104e48b028fb4074d398
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.

Show diffs side-by-side

added added

removed removed

Lines of Context:
96
96
        return pass
97
97
    end
98
98
 
 
99
    # List all signed certificates.
 
100
    def list
 
101
        Puppet::SSL::Certificate.search("*").collect { |c| c.name }
 
102
    end
 
103
 
99
104
    # Read the next serial from the serial file, and increment the
100
105
    # file so this one is considered used.
101
106
    def next_serial
119
124
        FileTest.exist? Puppet[:capass]
120
125
    end
121
126
 
 
127
    # Print a given host's certificate as text.
 
128
    def print(name)
 
129
        if cert = Puppet::SSL::Certificate.find(name)
 
130
            return cert.to_text
 
131
        else
 
132
            return nil
 
133
        end
 
134
    end
 
135
 
122
136
    # Revoke a given certificate.
123
137
    def revoke(name)
124
138
        raise ArgumentError, "Cannot revoke certificates when the CRL is disabled" unless crl