From 96b761b53e1284392975672a23dac0be504367c4 Mon Sep 17 00:00:00 2001 From: luke Date: Mon, 30 Jan 2006 16:18:24 +0000 Subject: Fixing waitforcert so that the client can actually add the certs once it receives them git-svn-id: https://reductivelabs.com/svn/puppet/trunk@856 980ebf18-57e1-0310-9a29-db15c13687c0 --- bin/puppetd | 8 ++++++++ lib/puppet/daemon.rb | 7 ++++++- lib/puppet/networkclient.rb | 4 ++++ lib/puppet/server/master.rb | 8 ++++++++ 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/bin/puppetd b/bin/puppetd index 18cfe7107..e575a8405 100755 --- a/bin/puppetd +++ b/bin/puppetd @@ -255,6 +255,14 @@ unless client.readcert 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) + unless client.readcert + PUppet.err "Could not read certificates after retrieving them" + exit(34) + end end if args[:Daemonize] diff --git a/lib/puppet/daemon.rb b/lib/puppet/daemon.rb index a8ef0a87a..fcedff3d7 100755 --- a/lib/puppet/daemon.rb +++ b/lib/puppet/daemon.rb @@ -3,7 +3,8 @@ require 'puppet' module Puppet - # A module that handles operations common to all daemons. + # A module that handles operations common to all daemons. This is included + # into the Server and Client base classes. module Daemon def daemonname $0.sub(/.+#{File::SEPARATOR}/,'') @@ -74,6 +75,7 @@ module Puppet return log end + # Read in an existing certificate. def readcert return unless @secureinit # verify we've got all of the certs set up and such @@ -109,6 +111,9 @@ module Puppet return true end + # Request a certificate from the remote system. This does all of the work + # of creating the cert request, contacting the remote system, and + # storing the cert locally. def requestcert retrieved = false # create the directories involved diff --git a/lib/puppet/networkclient.rb b/lib/puppet/networkclient.rb index 31bc9a9dd..fc204ce10 100644 --- a/lib/puppet/networkclient.rb +++ b/lib/puppet/networkclient.rb @@ -134,6 +134,10 @@ module Puppet def local false end + + def local? + false + end end end end diff --git a/lib/puppet/server/master.rb b/lib/puppet/server/master.rb index 1b9883ead..377b8e9e1 100644 --- a/lib/puppet/server/master.rb +++ b/lib/puppet/server/master.rb @@ -145,6 +145,14 @@ class Server return CGI.escape(str) end end + + def local? + if defined? @local and @local + return true + else + return false + end + end end end end -- cgit