Sha256: 0e1453f759e60e08946e93cc63e65467ec670f1ebaf94c590808980445eb15a9

Contents?: true

Size: 716 Bytes

Versions: 4

Compression:

Stored size: 716 Bytes

Contents

module Brightbox
  command [:lbs] do |cmd|

    cmd.desc "Remove nodes from a load balancer"
    cmd.arg_name "lb-id node-id..."
    cmd.command [:remove_nodes] do |c|

      c.action do |global_options, options, args|

        raise "You must specify the load balancer and the node ids to remove" if args.size < 2

        lb = LoadBalancer.find(args.shift)

        # We don't want to check servers exist as you can remove deleted
        # servers from a load balancer.
        nodes = args.collect { |a| Server.new(a) }

        info "Removing #{nodes.size} nodes from load balancer #{lb.id}"
        lb.remove_nodes nodes
        lb.reload
        render_table([lb], global_options)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
brightbox-cli-1.1.0 lib/brightbox-cli/commands/lbs-remove-nodes.rb
brightbox-cli-1.0.0 lib/brightbox-cli/commands/lbs-remove-nodes.rb
brightbox-cli-1.0.0.rc2 lib/brightbox-cli/commands/lbs-remove-nodes.rb
brightbox-cli-1.0.0.rc1 lib/brightbox-cli/commands/lbs-remove-nodes.rb