diff options
author | danielsdeleo <dan@getchef.com> | 2015-03-27 15:37:41 -0700 |
---|---|---|
committer | danielsdeleo <dan@getchef.com> | 2015-04-01 13:35:01 -0700 |
commit | bb882960a984fc7b80dec12c33cef09cdba9f65f (patch) | |
tree | 0806bbccd7a89e5c0203b93223ebfdca5d04da1a /lib/chef/rest.rb | |
parent | 110f3b77d46d4c58c00e1badeaec92875fb4e1ef (diff) | |
download | chef-bb882960a984fc7b80dec12c33cef09cdba9f65f.tar.gz |
Hoist socketless chef-zero support into Chef::HTTP
Was hoping to avoid this, but there are multiple subclasses of
Chef::HTTP that interact with the server, which all must support
socketless mode.
Diffstat (limited to 'lib/chef/rest.rb')
-rw-r--r-- | lib/chef/rest.rb | 34 |
1 files changed, 1 insertions, 33 deletions
diff --git a/lib/chef/rest.rb b/lib/chef/rest.rb index 8ff01e78da..2b1f2044c4 100644 --- a/lib/chef/rest.rb +++ b/lib/chef/rest.rb @@ -165,16 +165,11 @@ class Chef r["SERVER_PORT"] = "" r["rack.url_scheme"] = "chefzero" r["rack.input"] = StringIO.new(body_str) - pp rack_req: r res = ChefZero::Socketless.instance.request(r) - pp raw_rack_response: res - net_http_response = to_net_http(res[0], res[1], res[2]) - #pp net_http_response: net_http_response - yield net_http_response if block_given? [self, net_http_response] @@ -231,13 +226,7 @@ class Chef # HTTP GET request to http://localhost:4000/nodes def initialize(url, client_name=Chef::Config[:node_name], signing_key_filename=Chef::Config[:client_key], options={}) - url_as_uri = url.respond_to?(:scheme) ? url : URI.parse(url) - - # TODO: NEW STUFF ADD TESTS - scheme = url_as_uri.scheme - @socketless = (scheme == "chefzero") - signing_key_filename = nil if @socketless - + signing_key_filename = nil if chef_zero_uri?(url) options = options.dup options[:client_name] = client_name @@ -370,27 +359,6 @@ class Chef public :create_url - def create_url(path) - return path if path.is_a?(URI) - if path =~ /^(chefzero):\/\//i - URI.parse(path) - else - super - end - end - - def http_client(base_url=nil) - base_url ||= url - pp url_class: base_url.class, value: base_url - base_url = URI.parse(base_url) if base_url.kind_of?(String) - if base_url.scheme == "chefzero" - pp using_zero_client: base_url - SocketlessChefZeroClient.new(base_url) - else - BasicClient.new(base_url, :ssl_policy => Chef::HTTP::APISSLPolicy) - end - end - ############################################################################ # DEPRECATED ############################################################################ |