in eksupdate/src/boto_aws.py [0:0]
def outdated_lt(asgs,regionName):
''' Getting outdated launch template'''
asg_client = boto3.client("autoscaling",region_name=regionName)
asg = asg_client.describe_auto_scaling_groups(
AutoScalingGroupNames=[
asgs
])
# print(asg)
# # print(asg)
asg_name = asg['AutoScalingGroups'][0]['AutoScalingGroupName']
# print(asg_name)
# logs_pusher(asg_name)
launch_type = ""
if 'LaunchConfigurationName' in asg['AutoScalingGroups'][0]:
launch_type = "LaunchConfiguration"
elif 'LaunchTemplate' in asg['AutoScalingGroups'][0]:
launch_type = "LaunchTemplate"
elif 'MixedInstancesPolicy' in asg['AutoScalingGroups'][0]:
launch_type = "LaunchTemplate"
else:
return []
old_instances = []
# logs_pusher(launch_type)
if launch_type == "LaunchConfiguration":
temp = old_launchConfiguation_instances(asg_name,regionName)
if len(temp) > 0:
old_instances = temp
return old_instances
else:
return []
''' checking with launch Template'''
if launch_type == "LaunchTemplate":
temp = get_old_lt(asg_name,regionName)
if len(temp) > 0:
old_instances = temp
return old_instances
else:
return []
return []