Sha256: 3dfaa7ac15ad9736d1a22eaa9045f3f48c9d548b89a0c997d9c672d905670e6a

Contents?: true

Size: 1.47 KB

Versions: 16

Compression:

Stored size: 1.47 KB

Contents

require 'mccloud/util/iterator'

module Mccloud
  module Command
    include Mccloud::Util

    def sorry(selection, options)
      filter=@environment.config.mccloud.stackfilter

      puts
      on_selected_lbs(selection) do |id,lb|

        if lb.sorry_members.nil?
          puts "[#{lb.name}] has no sorry_members defined, skipping"
        else
          member_ids=Array.new
          lb_instance=lb.instance
          #Adding new member first
          lb.sorry_members.each do |member|
            vm=@environment.config.vms[member]
            server_instance=vm.instance
            unless server_instance.nil?
              unless lb_instance.nil?
                puts "[#{lb.name}] Registering #{vm.name} - #{server_instance.id} with loadbalancer "
                lb_instance.register_instances(server_instance.id)
                member_ids << server_instance.id
              else
                puts "[#{lb.name} Loadbalancer does not (yet) exist"
              end
            else
              puts "[#{lb.name}] Member #{member} is not yet created. "
            end
          end

          #Removing old members
          lb_instance.instances.each do |instance_id|
            unless member_ids.include?(instance_id)
              lb_instance=lb.instance
              lb_instance.deregister_instances(instance_id)
              puts "[#{lb.name}] De-registering member #{instance_id} with loadbalancer "

            end
          end
        end

      end

    end

  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
mccloud-0.1.1 lib/mccloud/provider/aws/provider/old_sorry.rb
mccloud-0.0.28 lib/mccloud/provider/aws/provider/old_sorry.rb
mccloud-0.0.27 lib/mccloud/provider/aws/provider/old_sorry.rb
mccloud-0.0.26 lib/mccloud/provider/aws/provider/old_sorry.rb
mccloud-0.0.25 lib/mccloud/provider/aws/provider/old_sorry.rb
mccloud-0.0.24 lib/mccloud/provider/aws/provider/old_sorry.rb
mccloud-0.0.23 lib/mccloud/provider/aws/provider/old_sorry.rb
mccloud-0.0.22 lib/mccloud/provider/aws/provider/old_sorry.rb
mccloud-0.0.21 lib/mccloud/provider/aws/provider/old_sorry.rb
mccloud-0.0.20 lib/mccloud/provider/aws/provider/old_sorry.rb
mccloud-0.0.19 lib/mccloud/provider/aws/provider/old_sorry.rb
mccloud-0.0.18 lib/mccloud/provider/aws/provider/old_sorry.rb
mccloud-0.0.17 lib/mccloud/provider/aws/provider/old_sorry.rb
mccloud-0.0.16 lib/mccloud/provider/aws/provider/old_sorry.rb
mccloud-0.0.15 lib/mccloud/provider/aws/provider/old_sorry.rb
mccloud-0.0.14 lib/mccloud/provider/aws/provider/old_sorry.rb