Class: Management::DestroyServer

Inherits:
Command
  • Object
show all
Defined in:
lib/management/commands/destroy_server.rb

Instance Method Summary collapse

Methods inherited from Command

all, #cloud, command_name, #config, #get_env, #get_script, #get_server, #get_type, help_string, inherited

Instance Method Details

#call(server_name) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/management/commands/destroy_server.rb', line 7

def call(server_name)
  server = get_server(server_name)

  print "Are you sure you want to do this? Type 'Yes' to continue, or anything else to abort: "
  answer = $stdin.gets.chomp

  if answer == 'Yes'
    server.destroy
    puts "Destroyed."
  else
    puts "Aborted."
  end
end