summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Mundrawala <jdmundrawala@gmail.com>2015-12-11 11:37:00 -0800
committerJay Mundrawala <jdmundrawala@gmail.com>2015-12-11 11:37:00 -0800
commitdc8c2a7fa98a83aceb466f35af36b25153d824c5 (patch)
treebe3fa1a74ed0a83554fab5b4bfd682e2a0372fe6
parent7bcd87fa3256d5b8a6e669975d632eb60003426c (diff)
downloadchef-dc8c2a7fa98a83aceb466f35af36b25153d824c5.tar.gz
Fix no_proxy setting in chef-configjdm/fix-no-proxy
Setting a value for `no_proxy` caused ruby to crash.
-rw-r--r--chef-config/lib/chef-config/config.rb2
-rw-r--r--chef-config/spec/unit/config_spec.rb11
2 files changed, 12 insertions, 1 deletions
diff --git a/chef-config/lib/chef-config/config.rb b/chef-config/lib/chef-config/config.rb
index 870dd8273c..d8cc4bff37 100644
--- a/chef-config/lib/chef-config/config.rb
+++ b/chef-config/lib/chef-config/config.rb
@@ -720,7 +720,7 @@ module ChefConfig
export_proxy("http", http_proxy, http_proxy_user, http_proxy_pass) if http_proxy
export_proxy("https", https_proxy, https_proxy_user, https_proxy_pass) if https_proxy
export_proxy("ftp", ftp_proxy, ftp_proxy_user, ftp_proxy_pass) if ftp_proxy
- export_no_proxy("no_proxy", no_proxy) if no_proxy
+ export_no_proxy(no_proxy) if no_proxy
end
# Builds a proxy uri and exports it to the appropriate environment variables. Examples:
diff --git a/chef-config/spec/unit/config_spec.rb b/chef-config/spec/unit/config_spec.rb
index 0a3dca5b5a..8c20b0bef8 100644
--- a/chef-config/spec/unit/config_spec.rb
+++ b/chef-config/spec/unit/config_spec.rb
@@ -677,6 +677,17 @@ RSpec.describe ChefConfig::Config do
end
include_examples "no export"
end
+
+ context "no_proxy is set" do
+ before do
+ ChefConfig::Config.no_proxy = "localhost"
+ end
+ it "exports ENV['no_proxy']" do
+ expect(ENV).to receive(:[]=).with('no_proxy', "localhost")
+ expect(ENV).to receive(:[]=).with('NO_PROXY', "localhost")
+ ChefConfig::Config.export_proxies
+ end
+ end
end
describe "allowing chefdk configuration outside of chefdk" do