public
Fork of lak/puppet
Description: Server automation framework and application
Homepage: http://reductivelabs.com/trac/puppet/
Clone URL: git://github.com/fujin/puppet.git
Fix for #1200

Added a simple if options[:test] to the certificate retrieval code so that we 
only exit when in test mode, and if we're not in test mode we should sleep for 
waitforcert instead of zombying the process.
Sleeping for the waitforcert value is only useful in some kind of loop, so I 
modified the unless block to a while ! block
fujin (author)
Fri May 16 00:23:06 -0700 2008
commit  a3fe56240e4a1ec49365ce0773ad40e3936f2a4e
tree    bfc74ec78a8038519a88aad7da0700b5cdcdcb90
parent  390db8061ae81174ee9d42e26a6ebfe7182ea529
...
342
343
344
345
 
346
347
348
...
354
355
356
357
 
 
 
 
 
358
359
360
...
370
371
372
373
 
374
375
376
...
342
343
344
 
345
346
347
348
...
354
355
356
 
357
358
359
360
361
362
363
364
...
374
375
376
 
377
378
379
380
0
@@ -342,7 +342,7 @@ if Puppet[:daemonize]
0
     client.daemonize
0
 end
0
 
0
-unless Puppet::Network::HttpPool.read_cert
0
+while ! Puppet::Network::HttpPool.read_cert
0
     # If we don't already have the certificate, then create a client to
0
     # request one.  Use the special ca stuff, don't use the normal server and port.
0
     caclient = Puppet::Network::Client.ca.new()
0
@@ -354,7 +354,11 @@ unless Puppet::Network::HttpPool.read_cert
0
             end
0
         rescue => detail
0
             Puppet.err "Could not request certificate: %s" % detail.to_s
0
-            exit(23)
0
+            if options[:test]
0
+              exit(23)
0
+            else
0
+              sleep options[:waitforcert]
0
+            end
0
         end
0
     else
0
         unless caclient.request_cert
0
@@ -370,7 +374,7 @@ unless Puppet::Network::HttpPool.read_cert
0
         Puppet.notice "Got signed certificate"
0
     else
0
         Puppet.err "Could not read certificates after retrieving them"
0
-        exit(34)
0
+        exit(34) if options[:test]
0
     end
0
 end
0
 

Comments