From 6c80e0ff6ae5e69bccd46bb2bd6261b78626f01e Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Mon, 4 Aug 2008 11:01:34 -0500 Subject: Making all certificates only support the plaintext format. None of them actually support yaml or marshal by default, and plaintext is easiest anyway. Signed-off-by: Luke Kanies --- lib/puppet/ssl/certificate.rb | 6 ++++++ lib/puppet/ssl/certificate_request.rb | 6 ++++++ lib/puppet/ssl/certificate_revocation_list.rb | 6 ++++++ lib/puppet/ssl/key.rb | 6 ++++++ spec/unit/ssl/certificate.rb | 4 ++++ spec/unit/ssl/certificate_request.rb | 4 ++++ spec/unit/ssl/certificate_revocation_list.rb | 4 ++++ spec/unit/ssl/key.rb | 4 ++++ 8 files changed, 40 insertions(+) diff --git a/lib/puppet/ssl/certificate.rb b/lib/puppet/ssl/certificate.rb index 16af85d06..82f251d9c 100644 --- a/lib/puppet/ssl/certificate.rb +++ b/lib/puppet/ssl/certificate.rb @@ -12,6 +12,12 @@ class Puppet::SSL::Certificate < Puppet::SSL::Base extend Puppet::Indirector indirects :certificate, :terminus_class => :file + # Because of how the format handler class is included, this + # can't be in the base class. + def self.supported_formats + [:str] + end + def expiration return nil unless content return content.not_after diff --git a/lib/puppet/ssl/certificate_request.rb b/lib/puppet/ssl/certificate_request.rb index 34cae5a3e..6a55b2bd1 100644 --- a/lib/puppet/ssl/certificate_request.rb +++ b/lib/puppet/ssl/certificate_request.rb @@ -7,6 +7,12 @@ class Puppet::SSL::CertificateRequest < Puppet::SSL::Base extend Puppet::Indirector indirects :certificate_request, :terminus_class => :file + # Because of how the format handler class is included, this + # can't be in the base class. + def self.supported_formats + [:str] + end + # How to create a certificate request with our system defaults. def generate(key) Puppet.info "Creating a new SSL certificate request for %s" % name diff --git a/lib/puppet/ssl/certificate_revocation_list.rb b/lib/puppet/ssl/certificate_revocation_list.rb index 3029c14a4..3e48ddba3 100644 --- a/lib/puppet/ssl/certificate_revocation_list.rb +++ b/lib/puppet/ssl/certificate_revocation_list.rb @@ -8,6 +8,12 @@ class Puppet::SSL::CertificateRevocationList < Puppet::SSL::Base extend Puppet::Indirector indirects :certificate_revocation_list, :terminus_class => :file + # Because of how the format handler class is included, this + # can't be in the base class. + def self.supported_formats + [:str] + end + # Knows how to create a CRL with our system defaults. def generate(cert, cakey) Puppet.info "Creating a new certificate revocation list" diff --git a/lib/puppet/ssl/key.rb b/lib/puppet/ssl/key.rb index a1d436090..359455b06 100644 --- a/lib/puppet/ssl/key.rb +++ b/lib/puppet/ssl/key.rb @@ -8,6 +8,12 @@ class Puppet::SSL::Key < Puppet::SSL::Base extend Puppet::Indirector indirects :key, :terminus_class => :file + # Because of how the format handler class is included, this + # can't be in the base class. + def self.supported_formats + [:str] + end + attr_accessor :password_file # Knows how to create keys with our system defaults. diff --git a/spec/unit/ssl/certificate.rb b/spec/unit/ssl/certificate.rb index 44918b9c5..eb2464a48 100755 --- a/spec/unit/ssl/certificate.rb +++ b/spec/unit/ssl/certificate.rb @@ -25,6 +25,10 @@ describe Puppet::SSL::Certificate do @class.indirection.terminus_class.should == :file end + it "should only support the text format" do + @class.supported_formats.should == [:str] + end + describe "when managing instances" do before do @certificate = @class.new("myname") diff --git a/spec/unit/ssl/certificate_request.rb b/spec/unit/ssl/certificate_request.rb index be5aa5a96..4a7d655ac 100755 --- a/spec/unit/ssl/certificate_request.rb +++ b/spec/unit/ssl/certificate_request.rb @@ -26,6 +26,10 @@ describe Puppet::SSL::CertificateRequest do @class.indirection.terminus_class.should == :file end + it "should only support the text format" do + @class.supported_formats.should == [:str] + end + describe "when managing instances" do before do @request = @class.new("myname") diff --git a/spec/unit/ssl/certificate_revocation_list.rb b/spec/unit/ssl/certificate_revocation_list.rb index 13febf744..39e32976d 100755 --- a/spec/unit/ssl/certificate_revocation_list.rb +++ b/spec/unit/ssl/certificate_revocation_list.rb @@ -16,6 +16,10 @@ describe Puppet::SSL::CertificateRevocationList do @class.indirection.terminus_class.should == :file end + it "should only support the text format" do + @class.supported_formats.should == [:str] + end + describe "when an instance" do before do @class.any_instance.stubs(:read_or_generate) diff --git a/spec/unit/ssl/key.rb b/spec/unit/ssl/key.rb index b64a8646e..66ed510a3 100755 --- a/spec/unit/ssl/key.rb +++ b/spec/unit/ssl/key.rb @@ -21,6 +21,10 @@ describe Puppet::SSL::Key do @class.indirection.terminus_class.should == :file end + it "should only support the text format" do + @class.supported_formats.should == [:str] + end + it "should have a method for determining whether it's a CA key" do @class.new("test").should respond_to(:ca?) end -- cgit