diff options
author | Luke Kanies <luke@madstop.com> | 2008-06-15 16:47:14 -0500 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2008-06-15 16:47:14 -0500 |
commit | c542dc065fd618ae85bb6e8960d8819f42aefaeb (patch) | |
tree | 32349ad75c88414e097d249b1be9669f2b5e599c | |
parent | 7b10c39bdc20cad3d4652008c404d576461d75e1 (diff) | |
download | puppet-c542dc065fd618ae85bb6e8960d8819f42aefaeb.tar.gz puppet-c542dc065fd618ae85bb6e8960d8819f42aefaeb.tar.xz puppet-c542dc065fd618ae85bb6e8960d8819f42aefaeb.zip |
Fixing #1168 for REST -- all ssl classes downcase their names.
This is a much cleaner fix than the xmlrpc version, thankfully. :)
-rw-r--r-- | CHANGELOG | 3 | ||||
-rw-r--r-- | lib/puppet/ssl/base.rb | 2 | ||||
-rw-r--r-- | lib/puppet/ssl/host.rb | 2 | ||||
-rwxr-xr-x | spec/unit/ssl/certificate.rb | 4 | ||||
-rwxr-xr-x | spec/unit/ssl/certificate_request.rb | 4 | ||||
-rwxr-xr-x | spec/unit/ssl/host.rb | 9 | ||||
-rwxr-xr-x | spec/unit/ssl/key.rb | 4 |
7 files changed, 26 insertions, 2 deletions
@@ -1,3 +1,6 @@ + Fixing #1168 for REST -- all ssl classes downcase their names. + This is a much cleaner fix than the xmlrpc version, thankfully. :) + Added a boolean 'crl' default value. Now we have a location for the CA CRL and the host CRL, and then a setting for configuring whether we should even use a CRL. This way we aren't trying to diff --git a/lib/puppet/ssl/base.rb b/lib/puppet/ssl/base.rb index 80bfcae84..08efb314b 100644 --- a/lib/puppet/ssl/base.rb +++ b/lib/puppet/ssl/base.rb @@ -23,7 +23,7 @@ class Puppet::SSL::Base end def initialize(name) - @name = name + @name = name.downcase end # Read content from disk appropriately. diff --git a/lib/puppet/ssl/host.rb b/lib/puppet/ssl/host.rb index e366bfbdd..7fee81a24 100644 --- a/lib/puppet/ssl/host.rb +++ b/lib/puppet/ssl/host.rb @@ -155,7 +155,7 @@ class Puppet::SSL::Host end def initialize(name = nil) - @name = name || Puppet[:certname] + @name = (name || Puppet[:certname]).downcase @key = @certificate = @certificate_request = nil @ca = (name == self.class.ca_name) end diff --git a/spec/unit/ssl/certificate.rb b/spec/unit/ssl/certificate.rb index 1cb164d3f..44918b9c5 100755 --- a/spec/unit/ssl/certificate.rb +++ b/spec/unit/ssl/certificate.rb @@ -34,6 +34,10 @@ describe Puppet::SSL::Certificate do @certificate.name.should == "myname" end + it "should downcase its name" do + @class.new("MyName").name.should == "myname" + end + it "should have a content attribute" do @certificate.should respond_to(:content) end diff --git a/spec/unit/ssl/certificate_request.rb b/spec/unit/ssl/certificate_request.rb index 351e5bbd5..be5aa5a96 100755 --- a/spec/unit/ssl/certificate_request.rb +++ b/spec/unit/ssl/certificate_request.rb @@ -35,6 +35,10 @@ describe Puppet::SSL::CertificateRequest do @request.name.should == "myname" end + it "should downcase its name" do + @class.new("MyName").name.should == "myname" + end + it "should have a content attribute" do @request.should respond_to(:content) end diff --git a/spec/unit/ssl/host.rb b/spec/unit/ssl/host.rb index b717da80e..f282de477 100755 --- a/spec/unit/ssl/host.rb +++ b/spec/unit/ssl/host.rb @@ -162,6 +162,15 @@ describe Puppet::SSL::Host do Puppet::SSL::Host.new.name.should == "myname" end + it "should downcase a passed in name" do + Puppet::SSL::Host.new("Host.Domain.Com").name.should == "host.domain.com" + end + + it "should downcase the certname if it's used" do + Puppet.settings.expects(:value).with(:certname).returns "Host.Domain.Com" + Puppet::SSL::Host.new().name.should == "host.domain.com" + end + it "should indicate that it is a CA host if its name matches the ca_name constant" do Puppet::SSL::Host.stubs(:ca_name).returns "myca" Puppet::SSL::Host.new("myca").should be_ca diff --git a/spec/unit/ssl/key.rb b/spec/unit/ssl/key.rb index 4cd8e856d..b64a8646e 100755 --- a/spec/unit/ssl/key.rb +++ b/spec/unit/ssl/key.rb @@ -38,6 +38,10 @@ describe Puppet::SSL::Key do key.password_file.should == "/ca/pass" end + it "should downcase its name" do + @class.new("MyName").name.should == "myname" + end + it "should set its password file to the default password file if it is not the CA key" do Puppet.settings.stubs(:value).returns "whatever" Puppet.settings.stubs(:value).with(:passfile).returns "/normal/pass" |