[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, master, updated. debian/0.24.6-1-356-g5718585

James Turnbull james at lovedthanlost.net
Fri Jan 23 14:21:17 UTC 2009


The following commit has been merged in the master branch:
commit fb14e91226e494210c3b6c88d8553a745e4ac3ed
Author: Andrew Shafer <andrew at reductivelabs.com>
Date:   Mon Oct 6 22:06:39 2008 -0600

    Fixed #1473 - Rescue Timeout::Error in xmlrpc clients
    
    Added a rescue block for Timeout::Error (which isn't a subclass of StandardError)
    Removed a Dev Error conditional to facilitate testing

diff --git a/CHANGELOG b/CHANGELOG
index be8e854..854b027 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,7 @@
 0.24.x
+    Fixed #1473 - Puppetd stops with error after puppetmasterd 
+    is unavailable
+
     Fixed #1354 - yum provider problems with RHEL 3
 
     Fixed #381 - Allow Allow multiple overrides in one statement
diff --git a/lib/puppet/network/xmlrpc/client.rb b/lib/puppet/network/xmlrpc/client.rb
index 6d77286..c79f91d 100644
--- a/lib/puppet/network/xmlrpc/client.rb
+++ b/lib/puppet/network/xmlrpc/client.rb
@@ -35,10 +35,6 @@ module Puppet::Network
 
             interface.methods.each { |ary|
                 method = ary[0]
-                if public_method_defined?(method)
-                    raise Puppet::DevError, "Method %s is already defined" %
-                        method
-                end
                 newclient.send(:define_method,method) { |*args|
                     Puppet.debug "Calling %s.%s" % [namespace, method]
                     begin
@@ -74,6 +70,10 @@ module Puppet::Network
                         Puppet.warning "Other end went away; restarting connection and retrying"
                         self.recycle_connection
                         retry
+                    rescue Timeout::Error => detail
+                        Puppet.err "Connection timeout calling %s.%s: %s" %
+                            [namespace, method, detail.to_s]
+                        raise XMLRPCClientError.new("Connection Timeout").set_backtrace(detail.backtrace)
                     rescue => detail
                         if detail.message =~ /^Wrong size\. Was \d+, should be \d+$/
                             Puppet.warning "XMLRPC returned wrong size.  Retrying."
diff --git a/spec/unit/network/xmlrpc/client.rb b/spec/unit/network/xmlrpc/client.rb
new file mode 100644
index 0000000..a0a2e77
--- /dev/null
+++ b/spec/unit/network/xmlrpc/client.rb
@@ -0,0 +1,13 @@
+#!/usr/bin/env ruby
+
+Dir.chdir(File.dirname(__FILE__)) { (s = lambda { |f| File.exist?(f) ? require(f) : Dir.chdir("..") { s.call(f) } }).call("spec/spec_helper.rb") }
+
+describe Puppet::Network do
+    it "should raise an XMLRPCClientError if a generated class raises a Timeout::Error" do
+        http = mock 'http'
+        Puppet::Network::HttpPool.stubs(:http_instance).returns http
+        file = Puppet::Network::Client.file.new({:Server => "foo.com"})
+        http.stubs(:post2).raises Timeout::Error
+        lambda { file.retrieve }.should raise_error(Puppet::Network::XMLRPCClientError)
+    end
+end

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list