Sha256: 730dff88c8647a90173708318f684c0c572407f25293ae679d99f6e8d2bbd1a3

Contents?: true

Size: 1.22 KB

Versions: 6

Compression:

Stored size: 1.22 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}

  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|

        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

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
auser-poolparty-1.2.10 bin/cloud-expand
auser-poolparty-1.2.11 bin/cloud-expand
auser-poolparty-1.2.12 bin/cloud-expand
auser-poolparty-1.2.8 bin/cloud-expand
auser-poolparty-1.2.9 bin/cloud-expand
fairchild-poolparty-1.2.12 bin/cloud-expand