Fix alarm action comparison (#23523)
This fixes issue when list from module contains more than one element. Ansible and/or boto may put same elements in list in different order, thus resulting task as changed. Fixes #3310
This commit is contained in:
parent
b6c00f722b
commit
94bd647bc0
1 changed files with 3 additions and 1 deletions
|
@ -225,7 +225,9 @@ def create_metric_alarm(connection, module):
|
|||
|
||||
for attr in ('alarm_actions','insufficient_data_actions','ok_actions'):
|
||||
action = module.params.get(attr) or []
|
||||
if getattr(alarm, attr) != action:
|
||||
# Boto and/or ansible may provide same elements in lists but in different order.
|
||||
# Compare on sets since they do not need any order.
|
||||
if set(getattr(alarm, attr)) != set(action):
|
||||
changed = True
|
||||
setattr(alarm, attr, module.params.get(attr))
|
||||
|
||||
|
|
Loading…
Reference in a new issue