Class: Elasticsearch::Drain::CLI
- Inherits:
-
Thor
- Object
- Thor
- Elasticsearch::Drain::CLI
- Defined in:
- lib/elasticsearch/drain/cli.rb
Instance Attribute Summary collapse
-
#active_nodes ⇒ Object
Returns the value of attribute active_nodes.
-
#drainer ⇒ Object
readonly
Returns the value of attribute drainer.
Instance Method Summary collapse
-
#asg ⇒ Object
rubocop:disable Metrics/MethodLength.
Instance Attribute Details
#active_nodes ⇒ Object
Returns the value of attribute active_nodes.
9 10 11 |
# File 'lib/elasticsearch/drain/cli.rb', line 9 def active_nodes @active_nodes end |
#drainer ⇒ Object (readonly)
Returns the value of attribute drainer.
8 9 10 |
# File 'lib/elasticsearch/drain/cli.rb', line 8 def drainer @drainer end |
Instance Method Details
#asg ⇒ Object
rubocop:disable Metrics/MethodLength
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/elasticsearch/drain/cli.rb', line 15 def asg # rubocop:disable Metrics/MethodLength @drainer = Elasticsearch::Drain.new([:host], [:asg], [:region]) ensure_cluster_healthy @active_nodes = drainer.active_nodes_in_asg do_exit { say_status 'Complete', 'Nothing to do', :green } if active_nodes.empty? say_status 'Found Nodes', "AutoScalingGroup: #{instances}", :magenta ensure_cluster_healthy drain_nodes remove_nodes say_status 'Complete', 'Draining nodes complete!', :green end |