7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/vagrant-arubacloud/command/servers.rb', line 7
def execute
options = {}
opts = OptionParser.new do |o|
o.banner = 'Usage: vagrant arubacloud servers [options]'
end
argv = parse_options(opts)
return unless argv
vm_count = 1
vm_list = Array.new
vm_size = 0
with_target_vms(argv, :provider => :arubacloud , :plist => '1' ) do |machine|
if vm_count == 1
ll = machine.name.length
ui_ext = Vagrant::UI::Prefixed.new( Vagrant::UI::Colored.new, " "*ll )
ui_ext.opts = { :color => :white, :bold => true }
ui_ext.detail ('%-6s %-20s %-8s %-12s %-14s %s' % ['DC', 'Server Name', ' Id ', 'State Code', 'State meaning', 'IPv4 address'])
ui_ext.detail ("-" * 80)
machine.provider_config.reserved_status = "owned"
vm_size = machine.config.vm.defined_vm_keys.length
end
if (vm_count == vm_size)
machine.provider_config.reserved_status = "other"
machine.provider_config.reserved_list_owned = vm_list
end
machine.action('list_servers')
vm_count += 1
if machine.provider_config.reserved_list_owned
vm_list << machine.provider_config.reserved_list_owned
end
end
end
|