Commit edf6cfa8 by Kevin Falcone Committed by GitHub

Merge pull request #3688 from edx/jibsheet/active_instances-improve-error-messages

Handle the edxapp worker case with two ASGs but no ELBs
parents e88f718f b10e08cf
......@@ -26,6 +26,7 @@ import botocore.exceptions
import sys
from collections import defaultdict
from os import environ
from itertools import chain
class ActiveInventory():
......@@ -61,6 +62,12 @@ class ActiveInventory():
# When we have more than a single active ASG, we need to bail out as we don't know what ASG to pick an instance from
print("Multiple active ASGs - unable to choose an instance", file=sys.stderr)
return
# If we found no active groups, because there are no ELBs (edxapp workers normally)
# print a sensible reason why we failed
elbs = list(chain.from_iterable([group['LoadBalancerNames'] for group in matching_groups]))
if not (active_groups or elbs):
print("Multiple ASGs and no ELB - unable to choose an instance", file=sys.stderr)
return
else:
active_groups = { g['AutoScalingGroupName']: 1 for g in matching_groups }
......
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