Permalink
Browse files

Add support for activate_console

  • Loading branch information...
1 parent 309d83d commit 109a3849df764b1f7a4f4645adfa3e918edec682 @johnl johnl committed Mar 1, 2011
Showing with 27 additions and 0 deletions.
  1. +23 −0 lib/bbcloud/commands/servers-activate-cloud.rb
  2. +4 −0 lib/bbcloud/servers.rb
@@ -0,0 +1,23 @@
+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
+ consoles << { :url => r["console_url"], :token => r["console_token"], :expires => r["console_token_expires"] }
+ end
+
+ render_table(consoles, global_options.merge(:fields => [:url, :token, :expires]))
+ end
+end
View
@@ -42,6 +42,10 @@ def destroy
raise Conflict, "Cannot delete server #{id}"
end
+ def activate_console
+ self.class.conn.activate_console_server id
+ end
+
def self.get(id)
conn.servers.get id
end

0 comments on commit 109a384

Please sign in to comment.