Sha256: e50eb601223ec1c5993af13e244781086a026db7055f408c2ec40922e304d589

Contents?: true

Size: 647 Bytes

Versions: 4

Compression:

Stored size: 647 Bytes

Contents

module Brightbox
  command [:servers] do |cmd|

    cmd.desc "Destroy servers"
    cmd.arg_name "[server-id...]"
    cmd.command [:destroy] do |c|
      c.action do |global_options, options, args|

        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.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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
brightbox-cli-1.1.0 lib/brightbox-cli/commands/servers-destroy.rb
brightbox-cli-1.0.0 lib/brightbox-cli/commands/servers-destroy.rb
brightbox-cli-1.0.0.rc2 lib/brightbox-cli/commands/servers-destroy.rb
brightbox-cli-1.0.0.rc1 lib/brightbox-cli/commands/servers-destroy.rb