Commit c18c71b6 authored by Bozhidar Zhelev's avatar Bozhidar Zhelev

adding timeout for the healthy vs desired while loop no to wait the gitlab...

adding timeout for the healthy vs desired while loop no to wait the gitlab job's 1 hour timeout on failure
parent c5b88554
......@@ -125,9 +125,15 @@ class ASG():
logging.info("No output from instance yet. Trying again in 10 seconds.")
sleep(10)
# Wait for remaining instances (if any) to come up too
while len(self.asgs_healthy_instances(inactive_asg)) < scale_to['desired']:
# Wait for remaining instances (if any) to come up too (up to 5 minutes = 300 attempts)
attempts = 0
max_attempts = 300
while len(self.asgs_healthy_instances(inactive_asg)) < scale_to['desired'] and attempts != max_attempts:
logging.info("Waiting for all instances to be healthy ...")
attempts += 1
if attempts == max_attempts:
logging.info("Max timeout reached without success... Exiting!")
raise exceptions.AkinakaLoggingError
logging.info("ASG fully healthy. Logging new ASG name to \"inactive_asg.txt\"")
open("inactive_asg.txt", "w").write(inactive_asg)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment