42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/kontena/plugin/upcloud/prompts.rb', line 42
def default_name
nodes = client.get("grids/#{current_grid}/nodes")
nodes = nodes['nodes'].select{ |n|
n['labels'] && n['labels'].include?('provider=upcloud'.freeze)
}
raise "Did not find any nodes with label provider=upcloud" if nodes.empty?
prompt.select("Select node:") do ||
nodes.sort_by{|n| n['node_number'] }.reverse.each do |node|
initial = node['initial_member'] ? '(initial) ' : ''
.choice "#{node['name']} #{initial}", node['name']
end
end
end
|