Method: Unix::Pkg#extract_rpm_proxy_options

Defined in:
lib/beaker/host/unix/pkg.rb

#extract_rpm_proxy_options(url) ⇒ String

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Extract RPM command’s proxy options from URL

Parameters:

Returns:

  • (String)

    httpproxy and httport options for rpm

Raises:

  • (StandardError)

    When encountering a string that cannot be parsed



290
291
292
293
294
295
296
297
298
# File 'lib/beaker/host/unix/pkg.rb', line 290

def extract_rpm_proxy_options(url)
  begin
    host, port = url.match(/https?:\/\/(.*):(\d*)/)[1,2]
    raise if host.empty? or port.empty?
    "--httpproxy #{host} --httpport #{port}"
  rescue
    raise "Cannot extract host and port from '#{url}'"
  end
end