1 |
hollow 09/10/08 09:53:45 |
2 |
|
3 |
Added: puppet-0.25.0-cert-names.patch |
4 |
Log: |
5 |
add hotfix for 0.24.x CA compatibility. Upstream bug #2617 |
6 |
(Portage version: 2.2_rc40/cvs/Linux i686) |
7 |
|
8 |
Revision Changes Path |
9 |
1.1 app-admin/puppet/files/puppet-0.25.0-cert-names.patch |
10 |
|
11 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/app-admin/puppet/files/puppet-0.25.0-cert-names.patch?rev=1.1&view=markup |
12 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/app-admin/puppet/files/puppet-0.25.0-cert-names.patch?rev=1.1&content-type=text/plain |
13 |
|
14 |
Index: puppet-0.25.0-cert-names.patch |
15 |
=================================================================== |
16 |
commit a1d3b04296babc42b6a00956508c86c18e2b39bc |
17 |
Author: Luke Kanies <luke@×××××××.com> |
18 |
Date: Fri Sep 18 12:09:44 2009 -0700 |
19 |
|
20 |
Fixing #2617 - use the cert name as specified |
21 |
|
22 |
This allows us to search for a cert, and we use the searched-for |
23 |
term as the cert name (for the wrapper, not the actual cert object), |
24 |
rather than the real cert name. |
25 |
|
26 |
This allows us to use symbolic names like 'ca', as we're currently doing. |
27 |
|
28 |
Signed-off-by: Luke Kanies <luke@×××××××.com> |
29 |
|
30 |
diff --git a/lib/puppet/indirector/certificate/rest.rb b/lib/puppet/indirector/certificate/rest.rb |
31 |
index 5999830..6f47c25 100644 |
32 |
--- a/lib/puppet/indirector/certificate/rest.rb |
33 |
+++ b/lib/puppet/indirector/certificate/rest.rb |
34 |
@@ -6,4 +6,10 @@ class Puppet::SSL::Certificate::Rest < Puppet::Indirector::REST |
35 |
|
36 |
use_server_setting(:ca_server) |
37 |
use_port_setting(:ca_port) |
38 |
+ |
39 |
+ def find(request) |
40 |
+ return nil unless result = super |
41 |
+ result.name = request.key unless result.name == request.key |
42 |
+ result |
43 |
+ end |
44 |
end |
45 |
diff --git a/spec/integration/indirector/certificate/rest.rb b/spec/integration/indirector/certificate/rest.rb |
46 |
index 3ebd1e5..71ef443 100755 |
47 |
--- a/spec/integration/indirector/certificate/rest.rb |
48 |
+++ b/spec/integration/indirector/certificate/rest.rb |
49 |
@@ -64,6 +64,8 @@ describe "Certificate REST Terminus" do |
50 |
|
51 |
# There's no good '==' method on certs. |
52 |
result.content.to_s.should == @host.certificate.content.to_s |
53 |
- result.name.should == @host.certificate.name |
54 |
+ |
55 |
+ # also make sure it uses the provided name, rather than the internal one. |
56 |
+ result.name.should == "bar" |
57 |
end |
58 |
end |
59 |
diff --git a/spec/unit/indirector/certificate/rest.rb b/spec/unit/indirector/certificate/rest.rb |
60 |
index d5959c4..a325754 100755 |
61 |
--- a/spec/unit/indirector/certificate/rest.rb |
62 |
+++ b/spec/unit/indirector/certificate/rest.rb |
63 |
@@ -20,4 +20,38 @@ describe Puppet::SSL::Certificate::Rest do |
64 |
it "should set port_setting to :ca_port" do |
65 |
Puppet::SSL::Certificate::Rest.port_setting.should == :ca_port |
66 |
end |
67 |
+ |
68 |
+ it "should make sure found certificates have their names set to the search string" do |
69 |
+ terminus = Puppet::SSL::Certificate::Rest.new |
70 |
+ |
71 |
+ # This has 'boo.com' in the CN |
72 |
+ cert_string = "-----BEGIN CERTIFICATE----- |
73 |
+MIICPzCCAaigAwIBAgIBBDANBgkqhkiG9w0BAQUFADAWMRQwEgYDVQQDDAtidWNr |
74 |
+eS5sb2NhbDAeFw0wOTA5MTcxNzI1MzJaFw0xNDA5MTYxNzI1MzJaMBIxEDAOBgNV |
75 |
+BAMMB2Jvby5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAKG9B+DkTCNh |
76 |
+F5xHchNDfnbC9NzWKM600oxrr84pgUVAG6B2wAZcdfoEtXszhsY9Jzpwqkvxk4Mx |
77 |
+AbYqo9+TCi4UoiH6e+vAKOOJD3DHrlf+/RW4hGtyaI41DBhf4+B4/oFz5PH9mvKe |
78 |
+NSfHFI/yPW+1IXYjxKLQNwF9E7q3JbnzAgMBAAGjgaAwgZ0wOAYJYIZIAYb4QgEN |
79 |
+BCsWKVB1cHBldCBSdWJ5L09wZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRlMAwG |
80 |
+A1UdEwEB/wQCMAAwHQYDVR0OBBYEFJOxEUeyf4cNOBmf9zIaE1JTuNdLMAsGA1Ud |
81 |
+DwQEAwIFoDAnBgNVHSUEIDAeBggrBgEFBQcDAQYIKwYBBQUHAwIGCCsGAQUFBwME |
82 |
+MA0GCSqGSIb3DQEBBQUAA4GBAFTJxKprMg6tfhGnvEvURPmlJrINn9c2b5Y4AGYp |
83 |
+tO86PFFkWw/EIJvvJzbj3s+Butr+eUo//+f1xxX7UCwwGqGxKqjtVS219oU/wkx8 |
84 |
+h7rW4Xk7MrLl0auSS1p4wLcAMm+ZImf94+j8Cj+tkr8eGozZceRV13b8+EkdaE3S |
85 |
+rn/G |
86 |
+-----END CERTIFICATE----- |
87 |
+" |
88 |
+ |
89 |
+ network = stub 'network' |
90 |
+ terminus.stubs(:network).returns network |
91 |
+ |
92 |
+ response = stub 'response', :code => "200", :body => cert_string |
93 |
+ response.stubs(:[]).with('content-type').returns "text/plain" |
94 |
+ network.expects(:get).returns response |
95 |
+ |
96 |
+ request = Puppet::Indirector::Request.new(:certificate, :find, "foo.com") |
97 |
+ result = terminus.find(request) |
98 |
+ result.should_not be_nil |
99 |
+ result.name.should == "foo.com" |
100 |
+ end |
101 |
end |