mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-16 01:45:25 -07:00
elb_target_group - prevent a KeyError exception (#45169)
Ensure ports to integers after allowing the key 'Targets' to be available in params
This commit is contained in:
parent
9d1bf32825
commit
038fd0d0f2
2 changed files with 7 additions and 4 deletions
|
@ -429,10 +429,6 @@ def create_or_update_target_group(connection, module):
|
|||
if params['TargetType'] == 'ip':
|
||||
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
|
||||
tg = get_target_group(connection, module)
|
||||
|
||||
|
@ -496,6 +492,10 @@ def create_or_update_target_group(connection, module):
|
|||
if module.params.get("targets"):
|
||||
params['Targets'] = module.params.get("targets")
|
||||
|
||||
# Correct type of target ports
|
||||
for target in params['Targets']:
|
||||
target['Port'] = int(target.get('Port', module.params.get('port')))
|
||||
|
||||
# get list of current target instances. I can't see anything like a describe targets in the doco so
|
||||
# describe_target_health seems to be the only way to get them
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue