update max size if equal to desired capacity

This commit is contained in:
Anuj Biyani
2013-05-31 15:16:41 -07:00
parent 6f74b5c511
commit 67c907aa04
3 changed files with 29 additions and 2 deletions

View File

@@ -1,4 +1,6 @@
class AwsHaRelease
attr_reader :max_size_change
def initialize(opts)
AWS.config(access_key_id: opts[:aws_access_key], secret_access_key: opts[:aws_secret_key], region: opts[:region])
@@ -8,9 +10,16 @@ class AwsHaRelease
if @group.nil?
raise ArgumentError, "The Auto Scaling Group named #{opts[:as_group_name]} does not exist in #{opts[:region]}."
end
@max_size_change = 0
end
def execute!
@group.suspend_processes 'ReplaceUnhealthy', 'AlarmNotification', 'ScheduledActions', 'AZRebalance'
if @group.max_size == @group.desired_capacity
@group.update(max_size: @group.max_size + 1)
@max_size_change += 1
end
end
end