From 6e0d6ddf5ef1cd6b23a672020bb657744b5a2c59 Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Mon, 5 May 2008 22:25:42 -0500 Subject: The REST infrastructure now correctly the SSL certificates. I don't think the whole thing is done, but at least the basic flows are in place. Now it's just a question of doing real-world tests and fleshing out the unit tests as necessary. --- lib/puppet/indirector/rest.rb | 11 +++++------ lib/puppet/network/http/mongrel/rest.rb | 10 +++++----- lib/puppet/network/http_pool.rb | 2 -- 3 files changed, 10 insertions(+), 13 deletions(-) (limited to 'lib') diff --git a/lib/puppet/indirector/rest.rb b/lib/puppet/indirector/rest.rb index d33150fc2..77dd0538b 100644 --- a/lib/puppet/indirector/rest.rb +++ b/lib/puppet/indirector/rest.rb @@ -3,21 +3,20 @@ require 'uri' # Access objects via REST class Puppet::Indirector::REST < Puppet::Indirector::Terminus - def rest_connection_details { :host => Puppet[:server], :port => Puppet[:masterport].to_i } end def network_fetch(path) - network {|conn| conn.get("/#{path}").body } + network.get("/#{path}").body end def network_delete(path) - network {|conn| conn.delete("/#{path}").body } + network.delete("/#{path}").body end def network_put(path, data) - network {|conn| conn.put("/#{path}", data).body } + network.put("/#{path}", data).body end def find(request) @@ -46,8 +45,8 @@ class Puppet::Indirector::REST < Puppet::Indirector::Terminus private - def network(&block) - Net::HTTP.start(rest_connection_details[:host], rest_connection_details[:port]) {|conn| yield(conn) } + def network + Puppet::Network::HttpPool.http_instance(rest_connection_details[:host], rest_connection_details[:port]) end def exception?(yaml_string) diff --git a/lib/puppet/network/http/mongrel/rest.rb b/lib/puppet/network/http/mongrel/rest.rb index 2a3d4f143..a471a62bf 100644 --- a/lib/puppet/network/http/mongrel/rest.rb +++ b/lib/puppet/network/http/mongrel/rest.rb @@ -2,12 +2,12 @@ require 'puppet/network/http/handler' class Puppet::Network::HTTP::MongrelREST < Mongrel::HttpHandler - include Puppet::Network::HTTP::Handler + include Puppet::Network::HTTP::Handler - def initialize(args={}) - super() - initialize_for_puppet(args) - end + def initialize(args={}) + super() + initialize_for_puppet(args) + end private diff --git a/lib/puppet/network/http_pool.rb b/lib/puppet/network/http_pool.rb index 8c73adba6..9dd4a576a 100644 --- a/lib/puppet/network/http_pool.rb +++ b/lib/puppet/network/http_pool.rb @@ -23,8 +23,6 @@ module Puppet::Network::HttpPool @ssl_host end - # This handles reading in the key and such-like. - extend Puppet::SSLCertificates::Support @http_cache = {} # Clear our http cache, closing all connections. -- cgit