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
46
47
48
49
50
|
# File 'lib/chef/knife/voxel_voxservers_inventory_list.rb', line 10
def run
= [ ui.color('ID', :bold), ui.color('Summary', :bold) ]
facilities = hapi.voxel_voxservers_facilities_list
unless facilities['facilities'].empty?
facilities['facilities']['facility'].each do |facility|
puts ui.color("#{facility['label']} (#{facility['description']})\n", :bold)
available_inventory = hapi.voxel_voxservers_inventory_list( :facility => facility['label'], :verbosity => 'compact' )
if available_inventory['facilities'].empty?
puts "No inventory available at this time."
else
inventory = available_inventory['facilities']['facility']['configuration']
inventory = [ inventory ] if inventory.is_a?(Hash)
local_inventory = .clone
inventory.each do |cfg|
local_inventory << cfg['id']
local_inventory << cfg['summary']
end
puts ui.list(local_inventory, :columns_across, 2)
end
puts "\n"
end
end
end
|