summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoah Kantrowitz <noah@coderanger.net>2018-06-23 21:36:40 -0700
committerNoah Kantrowitz <noah@coderanger.net>2018-06-23 21:36:40 -0700
commit76835ca40322dadda384694f00a17f73648cbf2f (patch)
tree2bff6ad7c0b85653a4b5189c76be30c4e3d634f5
parentcc7608f7a9eb1e7c4f4cd490c8762c8a391d7a6a (diff)
downloadchef-76835ca40322dadda384694f00a17f73648cbf2f.tar.gz
Use `has_key?` so as to not add the blank keys to the config unless needed.
Signed-off-by: Noah Kantrowitz <noah@coderanger.net>
-rw-r--r--chef-config/lib/chef-config/config.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/chef-config/lib/chef-config/config.rb b/chef-config/lib/chef-config/config.rb
index 1f98936188..c41e2b420f 100644
--- a/chef-config/lib/chef-config/config.rb
+++ b/chef-config/lib/chef-config/config.rb
@@ -970,10 +970,10 @@ module ChefConfig
# TODO add some post-file-parsing logic that automatically calls this so
# users don't have to
def self.export_proxies
- 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) if no_proxy
+ export_proxy("http", http_proxy, http_proxy_user, http_proxy_pass) if has_key?(:http_proxy)
+ export_proxy("https", https_proxy, https_proxy_user, https_proxy_pass) if has_key?(:https_proxy)
+ export_proxy("ftp", ftp_proxy, ftp_proxy_user, ftp_proxy_pass) if has_key?(:ftp_proxy)
+ export_no_proxy(no_proxy) if has_key?(:no_proxy)
end
# Character classes for Addressable