summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Doherty <cdoherty@chef.io>2016-03-02 12:40:25 -0800
committerChris Doherty <cdoherty@chef.io>2016-03-17 14:56:02 -0700
commita5d1c7c4fd0682d274a0d0e1fbfb10bbfa9016ae (patch)
treefba5876385c2698c760f3520a7435f6cf7f96450
parent81276da7a221ca1a935b069608580839e94b7154 (diff)
downloadchef-nls/proxy-cleanup.tar.gz
- Restore previous behavior where we use the user/pass from the URI, if present.nls/proxy-cleanup
- s/ChefConfig::Config.proxy_uri/Chef::Config.proxy_uri/
-rw-r--r--lib/chef/http/basic_client.rb14
-rw-r--r--lib/chef/provider/remote_file/ftp.rb2
2 files changed, 12 insertions, 4 deletions
diff --git a/lib/chef/http/basic_client.rb b/lib/chef/http/basic_client.rb
index b6ae5d9a6f..190635f798 100644
--- a/lib/chef/http/basic_client.rb
+++ b/lib/chef/http/basic_client.rb
@@ -96,7 +96,7 @@ class Chef
end
def proxy_uri
- @proxy_uri ||= ChefConfig::Config.proxy_uri(url.scheme, host, port)
+ @proxy_uri ||= Chef::Config.proxy_uri(url.scheme, host, port)
end
def build_http_client
@@ -120,11 +120,19 @@ class Chef
Net::HTTP
else
Chef::Log.debug("Using #{proxy_uri.host}:#{proxy_uri.port} for proxy")
- Net::HTTP.Proxy(proxy_uri.host, proxy_uri.port, proxy_uri.user,
- proxy_uri.password)
+ Net::HTTP.Proxy(proxy_uri.host, proxy_uri.port, http_proxy_user(proxy_uri),
+ http_proxy_pass(proxy_uri))
end
end
+ def http_proxy_user(proxy_uri)
+ proxy_uri.user || Chef::Config["#{proxy_uri.scheme}_proxy_user"]
+ end
+
+ def http_proxy_pass(proxy_uri)
+ proxy_uri.password || Chef::Config["#{proxy_uri.scheme}_proxy_pass"]
+ end
+
def configure_ssl(http_client)
http_client.use_ssl = true
ssl_policy.apply_to(http_client)
diff --git a/lib/chef/provider/remote_file/ftp.rb b/lib/chef/provider/remote_file/ftp.rb
index f63acdc06c..5935e83301 100644
--- a/lib/chef/provider/remote_file/ftp.rb
+++ b/lib/chef/provider/remote_file/ftp.rb
@@ -147,7 +147,7 @@ class Chef
end
def proxy_uri(uri)
- ChefConfig::Config.proxy_uri("ftp", hostname, port)
+ Chef::Config.proxy_uri("ftp", hostname, port)
end
def parse_path