Class: VagrantIp

Inherits:
Vagrant::Command::Base
  • Object
show all
Defined in:
lib/vagrant-ip.rb

Instance Method Summary collapse

Instance Method Details

#executeObject



18
19
20
21
22
23
24
25
26
# File 'lib/vagrant-ip.rb', line 18

def execute
  with_target_vms(nil, :single_target => true) do |vm|
    raise Vagrant::Errors::VMNotCreatedError if !vm.created?
    raise Vagrant::Errors::VMInaccessible if !vm.state == :inaccessible
    if ip = vm.driver.read_guest_bridged_ip
      puts ip
    end
  end
end