summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-06-15 16:47:14 -0500
committerLuke Kanies <luke@madstop.com>2008-06-15 16:47:14 -0500
commitc542dc065fd618ae85bb6e8960d8819f42aefaeb (patch)
tree32349ad75c88414e097d249b1be9669f2b5e599c
parent7b10c39bdc20cad3d4652008c404d576461d75e1 (diff)
downloadpuppet-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--CHANGELOG3
-rw-r--r--lib/puppet/ssl/base.rb2
-rw-r--r--lib/puppet/ssl/host.rb2
-rwxr-xr-xspec/unit/ssl/certificate.rb4
-rwxr-xr-xspec/unit/ssl/certificate_request.rb4
-rwxr-xr-xspec/unit/ssl/host.rb9
-rwxr-xr-xspec/unit/ssl/key.rb4
7 files changed, 26 insertions, 2 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 8a2344724..004398cd4 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -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"