Sha256: f29b0d90a719fa6986ce1b04f69804bf308f30a4cb22955a637859088ccde58f
Contents?: true
Size: 1.52 KB
Versions: 1
Compression:
Stored size: 1.52 KB
Contents
#!/usr/bin/ruby require 'rubygems' require 'optparse' require 'pool_party' # Set defaults list = PoolParty::Optioner.parse(ARGV.dup) options = PoolParty::Application.options(ARGV.dup) master = PoolParty::Master.new instance_options = { :instance_number => 0, :cmd => "ls -l", :src => "", :dest => "" } OptionParser.new do |op| op.on('-i inst', '--instance i', "The instance_number (default: 0)") {|x| instance_options[:instance_number] = x} op.on('-C cmd', '--command command', "Run this command on the instance (default: 'ls -l')") {|x| instance_options[:cmd] = x} op.on('-s src', '--source filename', "Send this file through scp (default: '')") {|x| instance_options[:src] = x} op.on('-d dest', '--destination filename', "Send file to (default: '')") {|x| instance_options[:dest] = x} end.parse!(ARGV.dup) instance = master.get_node(instance_options[:instance_number]) unless instance puts "Cloud is not running" exit end case list[0] when "ssh" PoolParty.message "Ssh'ing into #{instance.ip}" instance.ssh when "cmd" PoolParty.message "Executing #{instance_options[:cmd]} on #{instance.ip}" instance.ssh instance_options[:cmd] when "scp" instance.scp instance_options[:src], instance_options[:dest] when "restart" message "Restarting services" instance.restart_with_monit when "start" message "Starting services" instance.start_with_monit when "stop" message "Stopping services" instance.stop_with_monit when "install" message "Installing services" instance.install_stack else puts master.list end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
poolparty-0.0.4 | bin/instance |