Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added cloud-cssh

  • Loading branch information...
commit b7fd2c0f2210446e3000686b64a0f020945ee4e5 1 parent 8c07132
@howech howech authored committed
Showing with 37 additions and 0 deletions.
  1. +28 −0 bin/cloud-cssh
  2. +9 −0 lib/poolparty/cloud.rb
View
28 bin/cloud-cssh
@@ -0,0 +1,28 @@
+#!/usr/bin/env ruby
+$:.unshift(File.dirname(__FILE__) + "/../lib")
+require "poolparty"
+
+require 'git-style-binary/command'
+
+GitStyleBinary.command do
+ banner <<-EOS
+Usage: #{$0} #{all_options_string}
+
+ cssh into the cloud
+EOS
+
+ short_desc "cssh into the cloud"
+
+ opt :user, "the user name", :type => :string, :default => nil
+ opt :use_keypair, "whether or not to use the default keypair", :type => :integer, :default => 0
+
+ run do |command|
+ cloud = @loaded_clouds.first
+
+ user = command[:user]
+ keyp = command[:use_keypair]
+
+ cloud.cssh( user, keyp != 0 )
+
+ end
+end
View
9 lib/poolparty/cloud.rb
@@ -235,6 +235,15 @@ def cmd(commands, opts={})
results
end
+ def cssh(user = nil, use_keypair = nil)
+ opts = []
+ opts.push "-i #{keypair.full_filepath}" if use_keypair
+ opts.push "-l #{user}" if user
+ opts = opts.join(" ")
+ puts "cssh -o '#{opts}' " + nodes.map{|n| n.public_ip}.join(" ") + " &"
+ system "cssh -o '#{opts}' " + nodes.map{|n| n.public_ip}.join(" ") + " &"
+ end
+
# Explicit proxies to cloud_provider methods
def run_instance(o={}); cloud_provider.run_instance(o);end
def terminate_instance!(o={}); cloud_provider.terminate_instance!(o);end
Please sign in to comment.
Something went wrong with that request. Please try again.