bin/cloud-expand in auser-poolparty-1.2.12 vs bin/cloud-expand in auser-poolparty-1.3.0
- old
+ new
@@ -1,39 +1,38 @@
#!/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}
expands the cloud by a single instance
EOS
short_desc "expands the cloud by a single instance"
run do |command|
@loaded_clouds.each do |cld|
+
+ msg = [
+ "Expanding cloud #{cld.name} (#{cld.keypair})",
+ "#{cld.nodes.size} running instances (#{cld.minimum_instances} - #{cld.maximum_instances})"
+ ]
+
+ print_msg(msg)
+
+ inst = cld.expand
+ inst.bootstrap!
+
+ msg = [
+ "Your cloud has expanded by node: #{inst.public_ip}"
+ ]
+
+ print_msg(msg)
- vputs "Expanding cloud #{cld.name}"
- vputs "#{cld.nodes(:status => "running").size} running instances of #{cld.maximum_instances} possible instances"
- vputs testing ? "Not expanding (test mode)" : "Expanding the cloud"
-
- if cld.maximum_instances > cld.nodes(:status => "running").size
- cld.launch_instance!(:cloud_name => cld.name) do |node|
- ::PoolParty::Provision::BootStrapper.new(node.ip, :cloud => cld)
- ::PoolParty::Provision::DrConfigure.new(node.ip, :cloud => cld)
-
- puts <<-EOM
- Your cloud has expanded. The new ip is #{node.ip}
- EOM
- end
- else
- puts "The cloud #{cld.name} has too many instances already (#{cld.nodes(:status => "running").size})"
- end
-
- end
+ end
+
end
end
\ No newline at end of file