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
pull/23415/head
Łukasz Kostka 8 years ago committed by Matt Davis
parent b6c00f722b
commit 94bd647bc0

@ -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…
Cancel
Save