lib/vagrant/ssh.rb
# Returns the port which is either given in the options hash or taken from
# the config by finding it in the forwarded ports hash based on the
# `config.ssh.forwarded_port_key`.
Returns the port which is either given in the options hash or taken from
the config by finding it in the forwarded ports hash based on the
`config.ssh.forwarded_port_key`.
Returns the port which is either given in the options hash or taken from the config by finding it in the forwarded ports hash based on the ` config . ssh . forwarded_port_key ` .
def port(opts={})
      pnum = opts[:port]
      return pnum if pnum
      pnum = nil
      env.vm.vm.network_adapters.each do |na|
        pnum = na.nat_driver.forwarded_ports.detect do |fp|
          fp.name == env.config.ssh.forwarded_port_key
        end
        break if pnum
      end
      return pnum.hostport if pnum
      raise Errors::SSHPortNotDetected
    end
def port ( opts = { } ) pnum = opts [ :port ] return pnum if pnum pnum = nil env . vm . vm . network_adapters . each do | na | pnum = na . nat_driver . forwarded_ports . detect do | fp | fp . name == env . config . ssh . forwarded_port_key end break if pnum end return pnum . hostport if pnum raise Errors :: SSHPortNotDetected end
Returns the port which is either given in the options hash or taken from
the config by finding it in the forwarded ports hash based on the
`config.ssh.forwarded_port_key`.
Returns the port which is either given in the options hash or taken from the config by finding it in the forwarded ports hash based on the ` config . ssh . forwarded_port_key ` .
# Check if port was specified in options hash # Check if we have an SSH forwarded port # This should NEVER happen.
opts
<not_specific>