Please review pull request #14: (#11151) Fix attempted connection to "none" HTTP proxy opened by (domcleal)
Description:
Handle the default Puppet HTTP proxy hostname being the string "none". Same logic as Puppet's
lib/puppet/network/http_pool.rb.
http://projects.puppetlabs.com/issues/11151
- Opened: Sat Dec 03 23:18:27 UTC 2011
- Based on: puppetlabs:master (854fd63ce777ce48cf6e9984f7df9520c9edcb81)
- Requested merge: domcleal:tickets/master/11151 (1afd820d22a2e06e77e9373f08c55406f5cf135f)
Diff follows:
diff --git a/lib/puppet/module/tool.rb b/lib/puppet/module/tool.rb index 2abe949..3b58afe 100644 --- a/lib/puppet/module/tool.rb +++ b/lib/puppet/module/tool.rb @@ -90,7 +90,11 @@ def self.http_proxy_host return env.host end - return Puppet.settings[:http_proxy_host] + host = Puppet.settings[:http_proxy_host] + if host != "none" then + return host + end + nil end def self.http_proxy_port env = http_proxy_env diff --git a/lib/puppet/module/tool/repository.rb b/lib/puppet/module/tool/repository.rb index b3df497..1e8af11 100644 --- a/lib/puppet/module/tool/repository.rb +++ b/lib/puppet/module/tool/repository.rb @@ -42,8 +42,8 @@ def read_contact(request) ).start(@uri.host, @uri.port) do |http| http.request(request) end - rescue Errno::ECONNREFUSED, SocketError - abort "Could not reach remote repository" + rescue Errno::ECONNREFUSED, SocketError => e + abort "Could not reach remote repository at #{@uri}: #{e}" end end diff --git a/spec/unit/tool_spec.rb b/spec/unit/tool_spec.rb index 2d119b0..68ab25f 100644 --- a/spec/unit/tool_spec.rb +++ b/spec/unit/tool_spec.rb @@ -13,6 +13,14 @@ ENV["http_proxy"] = nil end + it "should handle no proxy with defaults" do + Puppet.settings.expects(:[]).with(:http_proxy_host).returns('none') + Puppet.settings.expects(:[]).with(:http_proxy_port).returns(3128) + + described_class.http_proxy_host.should == nil + described_class.http_proxy_port.should == 3128 + end + it "should support environment variable for port and host" do ENV["http_proxy"] = "http://test.com:8011" described_class.http_proxy_host.should == "test.com"
--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to puppet-dev@googlegroups.com.
To unsubscribe from this group, send email to puppet-dev+unsubscr...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.