diff options
author | Nathan L Smith <smith@chef.io> | 2015-12-30 11:10:51 -0600 |
---|---|---|
committer | Chris Doherty <cdoherty@chef.io> | 2016-03-17 14:49:49 -0700 |
commit | fda49f6f8133fbb6f389f1def8e0aad4856614b7 (patch) | |
tree | cc3a4fb54f58932e1be9f73ab290ebf728fa18ab /lib/chef/provider/remote_file | |
parent | 17ca25869fd9e0ce0a4ec013a5dc39549ecaa6f7 (diff) | |
download | chef-fda49f6f8133fbb6f389f1def8e0aad4856614b7.tar.gz |
Make handling of proxies more consistent
* Always use `*_proxy` environment variables.
* Make a `ChefConfig::Config.proxy_uri` method that gets used by
`Chef::Provider::RemoteFile::FTP` and `Chef::HTTP::BasicClient`.
* Remove `env` method from `Chef::HTTP::BasicClient` (using
`stub_const("ENV", ...)` in specs instead.)
* Remove `http_proxy_user` and `http_proxy_pass` methods from
`Chef::HTTP::BasicClient` (replaced by functionality in `ChefConfig`.)
Diffstat (limited to 'lib/chef/provider/remote_file')
-rw-r--r-- | lib/chef/provider/remote_file/ftp.rb | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/lib/chef/provider/remote_file/ftp.rb b/lib/chef/provider/remote_file/ftp.rb index b49e84fa69..f63acdc06c 100644 --- a/lib/chef/provider/remote_file/ftp.rb +++ b/lib/chef/provider/remote_file/ftp.rb @@ -146,19 +146,8 @@ class Chef tempfile end - #adapted from buildr/lib/buildr/core/transports.rb via chef/rest/rest_client.rb def proxy_uri(uri) - proxy = Chef::Config["ftp_proxy"] - proxy = URI.parse(proxy) if String === proxy - if Chef::Config["ftp_proxy_user"] - proxy.user = Chef::Config["ftp_proxy_user"] - end - if Chef::Config["ftp_proxy_pass"] - proxy.password = Chef::Config["ftp_proxy_pass"] - end - excludes = Chef::Config[:no_proxy].to_s.split(/\s*,\s*/).compact - excludes = excludes.map { |exclude| exclude =~ /:\d+$/ ? exclude : "#{exclude}:*" } - return proxy unless excludes.any? { |exclude| File.fnmatch(exclude, "#{host}:#{port}") } + ChefConfig::Config.proxy_uri("ftp", hostname, port) end def parse_path |