mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
[cloud] Only get rules if listener in elb_application_lb been identified in compare_rules (#30604)
* Only get rules if listener has been identified in compare_rules * Always cast the listener port to an integer.
This commit is contained in:
parent
46fd083138
commit
2804a2663a
1 changed files with 14 additions and 6 deletions
|
@ -619,6 +619,8 @@ def compare_listeners(connection, module, current_listeners, new_listeners, purg
|
|||
Compare listeners and return listeners to add, listeners to modify and listeners to remove
|
||||
Listeners are compared based on port
|
||||
|
||||
:param connection: ELBv2 boto3 connection
|
||||
:param module: Ansible module object
|
||||
:param current_listeners:
|
||||
:param new_listeners:
|
||||
:param purge_listeners:
|
||||
|
@ -659,10 +661,10 @@ def compare_rules(connection, module, current_listeners, listener):
|
|||
Compare rules and return rules to add, rules to modify and rules to remove
|
||||
Rules are compared based on priority
|
||||
|
||||
:param connection:
|
||||
:param module:
|
||||
:param current_listeners:
|
||||
:param listener:
|
||||
:param connection: ELBv2 boto3 connection
|
||||
:param module: Ansible module object
|
||||
:param current_listeners: list of listeners currently associated with the ELB
|
||||
:param listener: dict object of a listener passed by the user
|
||||
:return:
|
||||
"""
|
||||
|
||||
|
@ -672,8 +674,11 @@ def compare_rules(connection, module, current_listeners, listener):
|
|||
listener['ListenerArn'] = current_listener['ListenerArn']
|
||||
break
|
||||
|
||||
# Get rules for the listener
|
||||
current_rules = get_listener_rules(connection, module, listener['ListenerArn'])
|
||||
# If the listener exists (i.e. has an ARN) get rules for the listener
|
||||
if 'ListenerArn' in listener:
|
||||
current_rules = get_listener_rules(connection, module, listener['ListenerArn'])
|
||||
else:
|
||||
current_rules = []
|
||||
|
||||
rules_to_modify = []
|
||||
rules_to_delete = []
|
||||
|
@ -997,6 +1002,9 @@ def main():
|
|||
if key not in ['Protocol', 'Port', 'SslPolicy', 'Certificates', 'DefaultActions', 'Rules']:
|
||||
module.fail_json(msg="listeners parameter contains invalid dict keys. Should be one of 'Protocol', "
|
||||
"'Port', 'SslPolicy', 'Certificates', 'DefaultActions', 'Rules'.")
|
||||
# Make sure Port is always an integer
|
||||
elif key == 'Port':
|
||||
listener[key] = int(listener[key])
|
||||
|
||||
if not HAS_BOTO3:
|
||||
module.fail_json(msg='boto3 required for this module')
|
||||
|
|
Loading…
Reference in a new issue