diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-04-02 23:39:02 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-04-02 23:39:02 +0000 |
| commit | 7c7c2237e23828a352dae5b7786a008ea6605676 (patch) | |
| tree | 32ad44688833757bd11af530ba27a707c2fd6a2a /lib/puppet/server/ca.rb | |
| parent | 72774bbd4ade3d249970cf049d3824c6891ac66e (diff) | |
| download | puppet-7c7c2237e23828a352dae5b7786a008ea6605676.tar.gz puppet-7c7c2237e23828a352dae5b7786a008ea6605676.tar.xz puppet-7c7c2237e23828a352dae5b7786a008ea6605676.zip | |
Added a test for Type#remove, and fixed the method so it actually works. I was missing every other object, because i was iterating over the array being modified. This caused the Config stuff to often fail, because objects were not correctly being removed. All fixed now, though.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1053 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/server/ca.rb')
| -rw-r--r-- | lib/puppet/server/ca.rb | 49 |
1 files changed, 23 insertions, 26 deletions
diff --git a/lib/puppet/server/ca.rb b/lib/puppet/server/ca.rb index 8b0a1a46f..064fd496b 100644 --- a/lib/puppet/server/ca.rb +++ b/lib/puppet/server/ca.rb @@ -79,35 +79,12 @@ class Server return "" end - # okay, we're now going to store the public key if we don't already - # have it - public_key = csr.public_key - #unless FileTest.directory?(Puppet[:publickeydir]) - # Puppet.recmkdir(Puppet[:publickeydir]) - #end - pkeyfile = File.join(Puppet[:publickeydir], [hostname, "pem"].join('.')) + # We used to save the public key, but it's basically unnecessary + # and it mucks with the permissions requirements. + # save_pk(hostname, csr.public_key) - if FileTest.exists?(pkeyfile) - currentkey = File.open(pkeyfile) { |k| k.read } - unless currentkey == public_key.to_s - raise Puppet::Error, "public keys for %s differ" % hostname - end - else - File.open(pkeyfile, "w", 0644) { |f| - f.print public_key.to_s - } - end - #unless FileTest.directory?(Puppet[:certdir]) - # Puppet.recmkdir(Puppet[:certdir], 0770) - #end certfile = File.join(Puppet[:certdir], [hostname, "pem"].join(".")) - #puts hostname - #puts certfile - - #unless FileTest.directory?(Puppet[:csrdir]) - # Puppet.recmkdir(Puppet[:csrdir], 0770) - #end # first check to see if we already have a signed cert for the host cert, cacert = ca.getclientcert(hostname) if cert and cacert @@ -139,6 +116,26 @@ class Server raise "huh?" end end + + private + + # Save the public key. + def save_pk(hostname, public_key) + pkeyfile = File.join(Puppet[:publickeydir], [hostname, "pem"].join('.')) + + if FileTest.exists?(pkeyfile) + currentkey = File.open(pkeyfile) { |k| k.read } + unless currentkey == public_key.to_s + raise Puppet::Error, "public keys for %s differ" % hostname + end + else + File.open(pkeyfile, "w", 0644) { |f| + f.print public_key.to_s + } + end + end end end end + +# $Id$ |
