Fixed group name not being passed to wait_for_new_instances when replacing instances
Fixed group_name not being passed to wait_for_elb Minor code clean up
This commit is contained in:
parent
bd09ebe5b4
commit
04fcfdad2c
1 changed files with 5 additions and 6 deletions
|
@ -493,7 +493,7 @@ def replace(connection, module):
|
||||||
replace_instances = module.params.get('replace_instances')
|
replace_instances = module.params.get('replace_instances')
|
||||||
|
|
||||||
as_group = connection.get_all_groups(names=[group_name])[0]
|
as_group = connection.get_all_groups(names=[group_name])[0]
|
||||||
wait_for_new_instances(module, connection, as_group, wait_timeout, as_group.min_size, 'viable_instances')
|
wait_for_new_instances(module, connection, group_name, wait_timeout, as_group.min_size, 'viable_instances')
|
||||||
props = get_properties(as_group)
|
props = get_properties(as_group)
|
||||||
instances = props['instances']
|
instances = props['instances']
|
||||||
replaceable = 0
|
replaceable = 0
|
||||||
|
@ -513,8 +513,8 @@ def replace(connection, module):
|
||||||
as_group.min_size = min_size + batch_size
|
as_group.min_size = min_size + batch_size
|
||||||
as_group.desired_capacity = desired_capacity + batch_size
|
as_group.desired_capacity = desired_capacity + batch_size
|
||||||
as_group.update()
|
as_group.update()
|
||||||
wait_for_new_instances(module, connection, as_group, wait_timeout, as_group.min_size, 'viable_instances')
|
wait_for_new_instances(module, connection, group_name, wait_timeout, as_group.min_size, 'viable_instances')
|
||||||
wait_for_elb(connection, module, as_group)
|
wait_for_elb(connection, module, group_name)
|
||||||
as_group = connection.get_all_groups(names=[group_name])[0]
|
as_group = connection.get_all_groups(names=[group_name])[0]
|
||||||
props = get_properties(as_group)
|
props = get_properties(as_group)
|
||||||
instances = props['instances']
|
instances = props['instances']
|
||||||
|
@ -522,7 +522,7 @@ def replace(connection, module):
|
||||||
instances = replace_instances
|
instances = replace_instances
|
||||||
for i in get_chunks(instances, batch_size):
|
for i in get_chunks(instances, batch_size):
|
||||||
terminate_batch(connection, module, i)
|
terminate_batch(connection, module, i)
|
||||||
wait_for_new_instances(module, connection, as_group, wait_timeout, as_group.min_size, 'viable_instances')
|
wait_for_new_instances(module, connection, group_name, wait_timeout, as_group.min_size, 'viable_instances')
|
||||||
wait_for_elb(connection, module, group_name)
|
wait_for_elb(connection, module, group_name)
|
||||||
as_group = connection.get_all_groups(names=[group_name])[0]
|
as_group = connection.get_all_groups(names=[group_name])[0]
|
||||||
# return settings to normal
|
# return settings to normal
|
||||||
|
@ -589,8 +589,7 @@ def wait_for_new_instances(module, connection, group_name, wait_timeout, desired
|
||||||
wait_timeout = time.time() + wait_timeout
|
wait_timeout = time.time() + wait_timeout
|
||||||
while wait_timeout > time.time() and desired_size > props[prop]:
|
while wait_timeout > time.time() and desired_size > props[prop]:
|
||||||
time.sleep(10)
|
time.sleep(10)
|
||||||
as_groups = connection.get_all_groups(names=[group_name])
|
as_group = connection.get_all_groups(names=[group_name])[0]
|
||||||
as_group = as_groups[0]
|
|
||||||
props = get_properties(as_group)
|
props = get_properties(as_group)
|
||||||
if wait_timeout <= time.time():
|
if wait_timeout <= time.time():
|
||||||
# waiting took too long
|
# waiting took too long
|
||||||
|
|
Loading…
Reference in a new issue