bin/cloud-terminate in auser-poolparty-1.2.12 vs bin/cloud-terminate in auser-poolparty-1.3.0
- old
+ new
@@ -1,13 +1,12 @@
#!/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"
+GitStyleBinary.command do
banner <<-EOS
Usage: #{$0} #{all_options_string} COMMAND [ARGS]
terminate the cloud
EOS
@@ -16,25 +15,20 @@
opt :yes, "Answer yes to the are you sure question", :type => :boolean, :default => false
run do |command|
@loaded_clouds.each do |cld|
+ msg = [
+ "Shutting down #{cld.name} cloud",
+ "Are you sure? (Y/N)"
+ ]
- 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
+ o = command[:yes] || are_you_sure?(msg)
+ if o
+ vputs "Shutting down cloud"
+ cld.terminate!
+ else
+
end
end
end
end
\ No newline at end of file