diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-05-02 04:30:40 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-05-02 04:30:40 +0000 |
| commit | b67a19b6b0483d73178a928e9d1c2bb752b2f077 (patch) | |
| tree | dfb6505ece37940f251676bfa95712aba9771ee0 /bin | |
| parent | a435d076d4d61e35fe4433a5c3e76ffb2203ac5d (diff) | |
Fixing #132, which involved creating a separate CA client and using it to retrieve the certificates. There was more work to do because of the weird client/daemon/server heirarchy.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1160 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/puppetd | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/bin/puppetd b/bin/puppetd index 2b396fc1e..928ae5ba3 100755 --- a/bin/puppetd +++ b/bin/puppetd @@ -315,28 +315,29 @@ end server = nil unless client.readcert - if waitforcert + # If we don't already have the certificate, then create a client to + # request one. + caclient = Puppet::Client::CA.new(args) + if options[:waitforcert] begin - while ! client.requestcert do + while ! caclient.requestcert do Puppet.notice "Did not receive certificate" - sleep waitforcert + sleep options[:waitforcert] end rescue => detail Puppet.err "Could not request certificate: %s" % detail.to_s exit(23) end else - unless client.requestcert + unless caclient.requestcert Puppet.notice "No certificates; exiting" exit(1) end end - # Now, because the Net::HTTP object cannot be modified once we've connected, - # we need to recreate the client with the certs intact - client = Puppet::Client::MasterClient.new(args) + # Now read the new cert in. unless client.readcert - PUppet.err "Could not read certificates after retrieving them" + Puppet.err "Could not read certificates after retrieving them" exit(34) end end @@ -410,12 +411,12 @@ if options[:onetime] else threads = [] if server - Puppet.notice "Starting Puppet server version %s" % [Puppet.version] threads << Thread.new do begin server.start rescue => detail Puppet.err "Could not start server: %s" % [detail] + server.shutdown exit(1) end end @@ -423,12 +424,14 @@ else if options[:client] Puppet.notice "Starting Puppet client version %s" % [Puppet.version] - begin - client.start - rescue => detail - Puppet.err "Could not start client: %s" % [detail] - exit(1) - end + begin + client.start + rescue => detail + puts detail.backtrace + Puppet.err "Could not start client: %s" % [detail] + client.shutdown + exit(1) + end end threads << Thread.new do |
