Sha256: de00c7db5e8c35b7b1f7e25b429cda77da2b60fd1316b29c7b64e3f2aa96bcc2

Contents?: true

Size: 1.49 KB

Versions: 19

Compression:

Stored size: 1.49 KB

Contents

#!/usr/bin/env ruby
$:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
require "poolparty"
require "poolpartycl"
o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
  opts.on('-f [remote|local]', '--from [remote|local]', 'Remote or local (default: local)')    { |o| optioner.location o }
  opts.on('-r', '--remote', 'Remote listing')    { optioner.location "remote" }
  opts.on('-l', '--local', 'Local listing')    { optioner.location "local" }
  opts.on('-n name', '--name name', 'Listing for cloud name')    { |c| optioner.cloudname c }
end
load_pool(o.spec || Binary.get_existing_spec_location)

@location = o.location ? o.location : "remote"

include Remote

@clouds = o.cloudname ? [cloud(o.cloudname.downcase.to_sym)] : clouds

@clouds.each do |name, cloud|

  with_cloud(cloud, {:location => @location, :testing => o.testing}) do
    logger.info header("Maintaining cloud #{name}")
    if !minimum_number_of_instances_are_running?
      logger.warn "#{list_of_running_instances.size} running instances of between #{minimum_instances} and #{maximum_instances}"
      logger.warn "Launching new instance"
      expand_cloud_if_necessary( !testing )
    elsif !maximum_number_of_instances_are_not_running?
      logger.warn "#{list_of_running_instances.size} running instances of between #{minimum_instances} and #{maximum_instances}"
      logger.warn "Shutting down non-master instance"
      contract_cloud_if_necessary( !testing )
    else
      logger.info "Cloud is maintained"
    end    
  end  

end

Version data entries

19 entries across 19 versions & 2 rubygems

Version Path
auser-poolparty-0.2.15 bin/cloud-maintain
auser-poolparty-0.2.16 bin/cloud-maintain
auser-poolparty-0.2.20 bin/cloud-maintain
auser-poolparty-0.2.21 bin/cloud-maintain
auser-poolparty-0.2.22 bin/cloud-maintain
auser-poolparty-0.2.23 bin/cloud-maintain
auser-poolparty-0.2.24 bin/cloud-maintain
auser-poolparty-0.2.25 bin/cloud-maintain
auser-poolparty-0.2.26 bin/cloud-maintain
auser-poolparty-0.2.35 bin/cloud-maintain
auser-poolparty-0.2.36 bin/cloud-maintain
auser-poolparty-0.2.37 bin/cloud-maintain
auser-poolparty-0.2.4 bin/cloud-maintain
auser-poolparty-0.2.5 bin/cloud-maintain
auser-poolparty-0.2.6 bin/cloud-maintain
auser-poolparty-0.2.8 bin/cloud-maintain
auser-poolparty-0.2.9 bin/cloud-maintain
poolparty-0.2.18 bin/cloud-maintain
poolparty-0.2.6 bin/cloud-maintain