Method: Beaker::HostPrebuiltSteps#package_proxy

Defined in:
lib/beaker/host_prebuilt_steps.rb

#package_proxy(host, opts) ⇒ Object

Setup files for enabling requests to pass to a proxy server This works for the APT package manager on debian, ubuntu, and cumulus and YUM package manager on el, centos, fedora and redhat.

Parameters:

  • host (Host, Array<Host>, String, Symbol)

    One or more hosts to act upon

  • opts (Hash{Symbol=>String})

    Options to alter execution.

Options Hash (opts):



475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
# File 'lib/beaker/host_prebuilt_steps.rb', line 475

def package_proxy host, opts
  logger = opts[:logger]

  block_on host do |host|
    logger.debug("enabling proxy support on #{host.name}")
    case host['platform']
      when /ubuntu/, /debian/, /cumulus/
        host.exec(Command.new("echo 'Acquire::http::Proxy \"#{opts[:package_proxy]}/\";' >> /etc/apt/apt.conf.d/10proxy"))
      when /^el-/, /centos/, /fedora/, /redhat/, /eos/
        host.exec(Command.new("echo 'proxy=#{opts[:package_proxy]}/' >> /etc/yum.conf"))
    else
      logger.debug("Attempting to enable package manager proxy support on non-supported platform: #{host.name}: #{host['platform']}")
    end
  end
end