Sha256: c3787bae56537bdc09a4a13d8e6381d689c79e982095f1f0f7565be3071e8272

Contents?: true

Size: 1.03 KB

Versions: 9

Compression:

Stored size: 1.03 KB

Contents

#!/usr/bin/env ruby
$:.unshift(File.dirname(__FILE__) + "/../lib")
require "poolparty"
require "poolpartycl"
require 'git-style-binary/command'

GitStyleBinary.command do  
  version "PoolParty #{$0} command"  
  banner <<-EOS
Usage: #{$0} #{all_options_string} COMMAND [ARGS]

  terminate the cloud
EOS

  short_desc "terminate the cloud"
  
  opt :yes, "Answer yes to the are you sure question", :type => :boolean, :default => false

  run do |command|    
    @loaded_clouds.each do |cld|
      
      cld.nodes(:status => "running").each do |inst|
        msg = <<-EOM
    Shutting down #{inst.instance_id}
    Are you sure? (Y/N)
        EOM
        o = are_you_sure? msg || command[:yes]
        if o
          puts "Shutting down #{inst.instance_id}"
          cld.terminate_instance!(:instance_id => inst.instance_id)
        else
          if are_you_sure?(msg)
            puts "Shutting down #{inst.instance_id}"
            cld.terminate_instance!(:instance_id => inst.instance_id)
          end
        end
      end
      
    end    
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
auser-poolparty-1.2.10 bin/cloud-terminate
auser-poolparty-1.2.11 bin/cloud-terminate
auser-poolparty-1.2.12 bin/cloud-terminate
auser-poolparty-1.2.3 bin/cloud-terminate
auser-poolparty-1.2.4 bin/cloud-terminate
auser-poolparty-1.2.7 bin/cloud-terminate
auser-poolparty-1.2.8 bin/cloud-terminate
auser-poolparty-1.2.9 bin/cloud-terminate
fairchild-poolparty-1.2.12 bin/cloud-terminate