Sha256: 135f3ad9c876af77af49f4ee140c70d73e7a06845591e06e6269b582b05cf70a

Contents?: true

Size: 814 Bytes

Versions: 4

Compression:

Stored size: 814 Bytes

Contents

module Brightbox
  desc 'Activate the console service for one or more servers'
  arg_name 'server-id...'
  command [:activate_console] do |c|

    c.action do |global_options,options,args|

      raise "You must specify servers to activate the console for" if args.empty?

      servers = Server.find_or_call(args) do |id|
        raise "Couldn't find server #{id}"
      end

      consoles = []

      servers.each do |s|
        info "Activating console for server #{s}"
        r = s.activate_console
        url = "#{r["console_url"]}/?password=#{r["console_token"]}"
        consoles << { :url => url, :token => r["console_token"], :expires => r["console_token_expires"] }
      end

      render_table(consoles, global_options.merge(:fields => [:url, :token, :expires], :resize => false))
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
brightbox-cli-0.17.5 lib/brightbox-cli/commands/servers-activate-console.rb
brightbox-cli-0.17.4 lib/brightbox-cli/commands/servers-activate-console.rb
brightbox-cli-0.17.3 lib/brightbox-cli/commands/servers-activate-console.rb
brightbox-cli-0.17.2 lib/brightbox-cli/commands/servers-activate-console.rb