summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authornimisha <nimisha.sharad@msystechnologies.com>2017-06-02 15:02:20 +0530
committernimisha <nimisha.sharad@msystechnologies.com>2017-06-02 16:51:50 +0530
commit6c9e6b43743e95104dbb888b9fc87112aabb98a6 (patch)
treee4c20049a453e6d25a76d26bc6181eeafbc21889 /lib
parentd383d9078b99fd3442f0d53f6b65407b9305b641 (diff)
downloadchef-6c9e6b43743e95104dbb888b9fc87112aabb98a6.tar.gz
Checking for proxy error separately
Signed-off-by: nimisha <nimisha.sharad@msystechnologies.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/chef/knife.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/chef/knife.rb b/lib/chef/knife.rb
index 18792da44a..aa30f2e2ed 100644
--- a/lib/chef/knife.rb
+++ b/lib/chef/knife.rb
@@ -486,8 +486,11 @@ class Chef
ui.error "Failed to authenticate to #{server_url} as #{username} with key #{api_key}"
ui.info "Response: #{format_rest_error(response)}"
when Net::HTTPForbidden
- ui.error "You authenticated successfully to #{server_url} as #{username} but you are not authorized for this action.
- This is possibly a connectivity issue. Please check your proxy settings if any."
+ ui.error "You authenticated successfully to #{server_url} as #{username} but you are not authorized for this action."
+ proxy_env_vars = ENV.to_hash.keys.map(&:downcase) & %w{http_proxy https_proxy ftp_proxy socks_proxy no_proxy}
+ unless proxy_env_vars.empty?
+ ui.error "There are proxy servers configured, your Chef server may need to be added to NO_PROXY."
+ end
ui.info "Response: #{format_rest_error(response)}"
when Net::HTTPBadRequest
ui.error "The data in your request was invalid"