48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
# File 'lib/cloudstack-cli/helper.rb', line 48
def bootstrap_server_interactive
zones = client.list_zones
if zones.size > 1
say "Select a availability zone:", :yellow
print_options(zones)
zone = ask_number("Zone Nr.: ")
else
zone = 0
end
projects = client.list_projects
if yes?("Do you want to deploy your server within a project?") && projects.size > 0
if projects.size > 0
say "Select a project", :yellow
print_options(projects)
project = ask_number("Project Nr.: ")
end
project_id = projects[project]['id'] rescue nil
end
say "Please provide a name for the new server", :yellow
say "(spaces or special characters are NOT allowed)"
server_name = ask("Server name: ")
server_offerings = client.list_service_offerings
say "Select a computing offering:", :yellow
print_options(server_offerings)
service_offering = ask_number("Offering Nr.: ")
templates = client.list_templates(project_id: project_id, zone_id: zones[zone]["id"])
say "Select a template:", :yellow
print_options(templates)
template = ask_number("Template Nr.: ")
networks = client.list_networks(project_id: project_id, zone_id: zones[zone]["id"])
if networks.size > 1
say "Select a network:", :yellow
print_options(networks)
network = ask_number("Network Nr.: ")
else
network = 0
end
say "You entered the following configuration:", :yellow
table = [["Zone", zones[zone]["name"]]]
table << ["Server Name", server_name]
table << ["Template", templates[template]["name"]]
table << ["Offering", server_offerings[service_offering]["name"]]
table << ["Network", networks[network]["name"]]
table << ["Project", projects[project]["name"]] if project
print_table table
if yes? "Do you want to deploy this server?"
bootstrap_server(
server_name,
zones[zone]["name"],
templates[template]["name"],
server_offerings[service_offering]["name"],
[networks[network]["name"]], nil,
project ? projects[project]["name"] : nil
)
end
end
|