lib/bbcloud/commands/servers-destroy.rb in bbcloud-0.11.2 vs lib/bbcloud/commands/servers-destroy.rb in bbcloud-0.12.0

- old
+ new

@@ -1,22 +1,24 @@ -desc 'Destroy servers' -arg_name '[server-id...]' -command [:destroy] do |c| - c.action do |global_options, options, args| +module Brightbox + desc 'Destroy servers' + arg_name '[server-id...]' + command [:destroy] do |c| + c.action do |global_options, options, args| - raise "You must specify servers to destroy" if args.empty? + raise "You must specify servers to destroy" if args.empty? - servers = Server.find_or_call(args) do |id| - raise "Couldn't find server #{id}" - end + servers = Server.find_or_call(args) do |id| + raise "Couldn't find server #{id}" + end - servers.each do |server| - info "Destroying server #{server}" - begin - server.destroy - rescue Brightbox::Api::Conflict => e - error "Could not destroy #{server}" + servers.each do |server| + info "Destroying server #{server}" + begin + server.destroy + rescue Brightbox::Api::Conflict => e + error "Could not destroy #{server}" + end end - end + end end end