Class: VagrantPlugins::Qubes::CapAddress

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-qubes/command.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.synopsisObject



6
7
8
# File 'lib/vagrant-qubes/command.rb', line 6

def self.synopsis
    "outputs the IP address of a guest."
end

Instance Method Details

#executeObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/vagrant-qubes/command.rb', line 9

def execute
  opts = OptionParser.new do |o|
    o.banner = "Usage: vagrant address [name]"
  end

  argv = parse_options(opts)

  # Count total number of vms to print the IP
  totalvms = 0
  with_target_vms(argv) do
    totalvms += 1
  end

  if argv.length == 1 or totalvms == 1
    with_target_vms(argv, {:single_target=>true}) do |machine|
      machine.action(:address)
    end
  else
    with_target_vms(argv) do |machine|
      machine.action(:address_multi)
    end
  end
end