5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/vagrant/hostmaster/command/base.rb', line 5
def execute
sub_command = self.class.name.split('::').last.downcase
parser = OptionParser.new do |opts|
opts.banner = "Usage: vagrant hosts #{sub_command} [vm-name]"
end
argv = parse_options(parser)
return if !argv
with_target_vms(argv) do |vm|
if vm.state == :running
Hostmaster::VM.new(vm).send sub_command.to_sym
elsif vm.created?
vm.ui.info I18n.t("vagrant.commands.common.vm_not_running")
else
vm.ui.info I18n.t("vagrant.commands.common.vm_not_created")
end
end
0
end
|