app/controllers/servers_controller.rb in rumm-0.0.3 vs app/controllers/servers_controller.rb in rumm-0.0.4
- old
+ new
@@ -1,8 +1,7 @@
class ServersController < MVCLI::Controller
requires :compute
- requires :naming
requires :command
def index
compute.servers.all
end
@@ -11,20 +10,24 @@
#What if you have two or more servers with the same name?
server
end
def create
+ template = Servers::CreateForm
+ argv = MVCLI::Argv.new command.argv
+ form = template.new argv.options
+ form.validate!
#Add personalization
options = {
- name: naming.generate_name('s', 's'),
- flavor_id: 2,
- image_id: '9922a7c7-5a42-4a56-bc6a-93f857ae2346',
- private_key_path: "~/.ssh/id_dsa",
- public_key_path: "~/.ssh/id_dsa.pub"
+ name: form.name,
+ flavor_id: form.flavor_id,
+ image_id: form.image_id,
+ private_key_path: "~/.ssh/id_rsa",
+ public_key_path: "~/.ssh/id_rsa.pub"
}
command.output.puts "--> bootstrapping server #{options[:name]}"
#Progress bar
- server = compute.servers.bootstrap options
+ server = compute.servers.create options
command.output.puts " done."
return server
end
def destroy