diff --git a/lib/puppet_x/bodeco/util.rb b/lib/puppet_x/bodeco/util.rb index a390345c..0af71e49 100644 --- a/lib/puppet_x/bodeco/util.rb +++ b/lib/puppet_x/bodeco/util.rb @@ -25,10 +25,15 @@ def initialize(_url, options) @password = options[:password] @cookie = options[:cookie] @insecure = options[:insecure] - proxy_server = options[:proxy_server] - proxy_type = options[:proxy_type] - ENV["#{proxy_type}_proxy"] = proxy_server + if options[:proxy_server] + uri = URI(options[:proxy_server]) + unless uri.scheme + uri = URI("#{options[:proxy_type]}://#{options[:proxy_server]}") + end + @proxy_addr = uri.hostname + @proxy_port = uri.port + end ENV['SSL_CERT_FILE'] = File.expand_path(File.join(__FILE__, '..', 'cacert.pem')) if Facter.value(:osfamily) == 'windows' && !ENV.key?('SSL_CERT_FILE') end @@ -48,7 +53,7 @@ def follow_redirect(uri, option = { limit: FOLLOW_LIMIT }, &block) else { use_ssl: false } end - Net::HTTP.start(uri.host, uri.port, http_opts) do |http| + Net::HTTP.start(uri.host, uri.port, @proxy_addr, @proxy_port, http_opts) do |http| http.request(generate_request(uri)) do |response| case response when Net::HTTPSuccess