1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Ensure that target group ports are cast to int on creation (#44442)

A previous fix fixed this for existing target groups but not
for new target groups

Fixes #37368
This commit is contained in:
Will Thames 2018-08-23 03:51:59 +10:00 committed by Ryan Brown
parent dd8edf5ae2
commit c4303804bf

View file

@ -429,6 +429,10 @@ def create_or_update_target_group(connection, module):
if params['TargetType'] == 'ip': if params['TargetType'] == 'ip':
fail_if_ip_target_type_not_supported(module) fail_if_ip_target_type_not_supported(module)
# Correct type of target ports
for target in params['Targets']:
target['Port'] = int(target.get('Port', module.params.get('port')))
# Get target group # Get target group
tg = get_target_group(connection, module) tg = get_target_group(connection, module)
@ -515,7 +519,7 @@ def create_or_update_target_group(connection, module):
instances_to_add = [] instances_to_add = []
for target in params['Targets']: for target in params['Targets']:
if target['Id'] in add_instances: if target['Id'] in add_instances:
instances_to_add.append({'Id': target['Id'], 'Port': int(target.get('Port', module.params.get('port')))}) instances_to_add.append({'Id': target['Id'], 'Port': target['Port']})
changed = True changed = True
try: try: