> I find this quite invasive (and also this code is duplicated 4 times).
>
> Can you isolate the gory details of the "remaining" inside the Resolver
> (or a method in the rest indirection), and just write the various rest
> verbs as in (didn't test the code, though):
>
> resolve(request) { |request|
>   result =  deserialize(network(request).get(indirection2uri(request), 
> headers))
> }
>
> with:
>
> def resolve(request)
>   Puppet::Network::Resolver.servers(request.server || self.class.server, 
> request.port || self.class.port) do |server, port, remaining|
>     request.server = server
>     request.port = port
>
>     begin
>       yield request
>       break
>     rescue SystemCallError => e
>       Puppet.warning "Error connecting to #{server}:#{port}: #{e.message}"
>       raise unless remaining > 0
>     end
>   end
> end

Agreed, I will make the changes.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to