Sha256: 18f0b12f94b44b901bd6b6492c6b977601c87b77014365dca1dd440f387650bf

Contents?: true

Size: 1.23 KB

Versions: 59

Compression:

Stored size: 1.23 KB

Contents

module Puppet::Util::HttpProxy

  def self.http_proxy_env
    # Returns a URI object if proxy is set, or nil
    proxy_env = ENV["http_proxy"] || ENV["HTTP_PROXY"]
    begin
      return URI.parse(proxy_env) if proxy_env
    rescue URI::InvalidURIError
      return nil
    end
    return nil
  end

  def self.http_proxy_host
    env = self.http_proxy_env

    if env and env.host
      return env.host
    end

    if Puppet.settings[:http_proxy_host] == 'none'
      return nil
    end

    return Puppet.settings[:http_proxy_host]
  end

  def self.http_proxy_port
    env = self.http_proxy_env

    if env and env.port
      return env.port
    end

    return Puppet.settings[:http_proxy_port]
  end

  def self.http_proxy_user
    env = self.http_proxy_env

    if env and env.user
      return env.user
    end

    if Puppet.settings[:http_proxy_user] == 'none'
      return nil
    end

    return Puppet.settings[:http_proxy_user]
  end

  def self.http_proxy_password
    env = self.http_proxy_env

    if env and env.password
      return env.password
    end

    if Puppet.settings[:http_proxy_user] == 'none' or Puppet.settings[:http_proxy_password] == 'none'
      return nil
    end

    return Puppet.settings[:http_proxy_password]
  end
end

Version data entries

59 entries across 59 versions & 2 rubygems

Version Path
puppet-retrospec-0.12.2 vendor/gems/puppet-3.7.3/lib/puppet/util/http_proxy.rb
puppet-3.8.7 lib/puppet/util/http_proxy.rb
puppet-3.8.7-x86-mingw32 lib/puppet/util/http_proxy.rb
puppet-3.8.7-x64-mingw32 lib/puppet/util/http_proxy.rb
puppet-3.8.6 lib/puppet/util/http_proxy.rb
puppet-3.8.6-x86-mingw32 lib/puppet/util/http_proxy.rb
puppet-retrospec-0.12.1 vendor/gems/puppet-3.7.3/lib/puppet/util/http_proxy.rb
puppet-3.8.6-x64-mingw32 lib/puppet/util/http_proxy.rb
puppet-retrospec-0.12.0 vendor/gems/puppet-3.7.3/lib/puppet/util/http_proxy.rb
puppet-3.8.5 lib/puppet/util/http_proxy.rb
puppet-3.8.5-x86-mingw32 lib/puppet/util/http_proxy.rb
puppet-3.8.5-x64-mingw32 lib/puppet/util/http_proxy.rb
puppet-3.8.4 lib/puppet/util/http_proxy.rb
puppet-3.8.4-x86-mingw32 lib/puppet/util/http_proxy.rb
puppet-3.8.4-x64-mingw32 lib/puppet/util/http_proxy.rb
puppet-retrospec-0.11.0 vendor/gems/puppet-3.7.3/lib/puppet/util/http_proxy.rb
puppet-retrospec-0.10.0 vendor/gems/puppet-3.7.3/lib/puppet/util/http_proxy.rb
puppet-retrospec-0.9.1 vendor/gems/puppet-3.7.3/lib/puppet/util/http_proxy.rb
puppet-retrospec-0.9.0 vendor/gems/puppet-3.7.3/lib/puppet/util/http_proxy.rb
puppet-retrospec-0.8.1 vendor/gems/puppet-3.7.3/lib/puppet/util/http_proxy.rb