From dd4d8684fc19adcb68c681ba1c446a737498cda0 Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Tue, 6 May 2008 19:02:45 -0500 Subject: Fixing the HttpPool module to get rid of an infinite loop. We can't have the HttpPool class use the Indirector to see if it has a cert available, because it might be being used to try to download one, which would cause it to make an http instance, which would cause it to... Well, you get the idea. Adding and fixing a few other tests I ran into on the way. --- lib/puppet/network/client/ca.rb | 2 +- lib/puppet/network/http_pool.rb | 2 +- lib/puppet/network/xmlrpc/client.rb | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) (limited to 'lib/puppet') diff --git a/lib/puppet/network/client/ca.rb b/lib/puppet/network/client/ca.rb index a2704e451..5fbdfe9e3 100644 --- a/lib/puppet/network/client/ca.rb +++ b/lib/puppet/network/client/ca.rb @@ -45,7 +45,7 @@ class Puppet::Network::Client::CA < Puppet::Network::Client end unless @cert.check_private_key(key) - raise InvalidCertificate, "Certificate does not match private key. Try 'puppetca --clean %s' on the server." % Facter.value(:fqdn) + raise InvalidCertificate, "Certificate does not match private key. Try 'puppetca --clean %s' on the server." % Puppet[:certname] end # Only write the cert out if it passes validating. diff --git a/lib/puppet/network/http_pool.rb b/lib/puppet/network/http_pool.rb index 9dd4a576a..24cbee656 100644 --- a/lib/puppet/network/http_pool.rb +++ b/lib/puppet/network/http_pool.rb @@ -50,7 +50,7 @@ module Puppet::Network::HttpPool # Use cert information from a Puppet client to set up the http object. def self.cert_setup(http) # Just no-op if we don't have certs. - return false unless ssl_host.certificate + return false unless FileTest.exist?(Puppet[:hostcert]) # ssl_host.certificate http.cert_store = ssl_host.ssl_store http.ca_file = Puppet[:localcacert] diff --git a/lib/puppet/network/xmlrpc/client.rb b/lib/puppet/network/xmlrpc/client.rb index e0fb5a0ab..dfd4a95a7 100644 --- a/lib/puppet/network/xmlrpc/client.rb +++ b/lib/puppet/network/xmlrpc/client.rb @@ -51,7 +51,8 @@ module Puppet::Network end ["certificate verify failed", "hostname was not match", "hostname not match"].each do |str| if detail.message.include?(str) - Puppet.warning "Certificate validation failed; considering using the certname configuration option" + Puppet.warning "Certificate validation failed; consider using the certname configuration option" + break end end raise XMLRPCClientError, -- cgit