No conflicts with Naz ;)

parent ccc7d22b
......@@ -23,7 +23,7 @@ class ASG():
# If we already have the ASG to do then move on, otherwise set target_groups
# for use in working it out below
if self.asg is not None:
new_asg = self.asg
return self.asg
elif self.loadbalancer is not None and self.target_group is None:
target_groups = self.get_lb_target_groups()
elif self.loadbalancer is None and self.target_group is not None:
......@@ -33,13 +33,13 @@ class ASG():
One of these mutually exclusive options need to be passed:
--lb
--asg
--target-groups
--target-group
""")
exit(1)
# If target_groups is set, it means we couldn't work out the ASG without it (see above)
if target_groups is not None:
current_asg_instances = self.current_asg_instances_of_target_group(target_groups)
current_asg_instances = self.target_groups_instances(target_groups)
new_asg = self.get_inactive_asg(current_asg_instances)
return new_asg
......@@ -142,7 +142,6 @@ class ASG():
for arn in target_group_arns:
target_group_instances = alb_client.describe_target_health(TargetGroupArn=arn)['TargetHealthDescriptions']
import pdb;pdb.set_trace()
for instance in target_group_instances:
if instance['TargetHealth']['State'] == 'healthy':
......@@ -150,13 +149,8 @@ class ASG():
return target_groups_instances
def current_asg_instances_of_target_group(self, target_groups=None):
def target_groups_instances(self, target_groups):
ec2_client = aws_client.create_client('ec2', self.region, self.role_arn)
if self.target_group is not None:
target_groups = [self.get_target_group_arn(self.target_group)]
else:
target_groups = self.get_lb_target_groups()
target_groups_instances = self.get_target_groups_instances(target_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