Class: Management::DestroyServers
- Includes:
- Helper
- Defined in:
- lib/management/commands/destroy_servers.rb
Instance Method Summary collapse
Methods included from Helper
#cloud, #config, #get_address, #get_env, #get_script, #get_server, #get_type, #live_servers, #system_verbose
Methods inherited from Command
all, #call_with, #command_name, #fn, #help_string, inherited, #true_arity
Instance Method Details
#run(*server_names) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/management/commands/destroy_servers.rb', line 9 def run(*server_names) servers = server_names.map{|server_name| get_server(server_name)} puts "You are about to delete the following servers:" puts ['', *servers.map{ |server| " - #{server.name}" }, '', ''].join("\n") print "Are you sure you want to do this? Type 'Yes' to continue, or anything else to abort: " abort "Aborted." if $stdin.gets.chomp != 'Yes' servers.each do |server| puts "Destroying #{server.name}..." server.destroy puts "Done." end end |