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

datadog_monitor: fix template vars in 'name' and 'escalation_message' (#38483)

This commit is contained in:
David Resnick 2018-09-20 00:34:53 +03:00 committed by ansibot
parent 5fdf0290d0
commit 02bfb9047c

View file

@ -221,7 +221,7 @@ def _get_monitor(module):
else:
monitors = api.Monitor.get_all()
for monitor in monitors:
if monitor['name'] == module.params['name']:
if monitor['name'] == _fix_template_vars(module.params['name']):
return monitor
return {}
@ -229,7 +229,9 @@ def _get_monitor(module):
def _post_monitor(module, options):
try:
kwargs = dict(type=module.params['type'], query=module.params['query'],
name=module.params['name'], message=_fix_template_vars(module.params['message']),
name=_fix_template_vars(module.params['name']),
message=_fix_template_vars(module.params['message']),
escalation_message=_fix_template_vars(module.params['escalation_message']),
options=options)
if module.params['tags'] is not None:
kwargs['tags'] = module.params['tags']
@ -251,7 +253,9 @@ def _equal_dicts(a, b, ignore_keys):
def _update_monitor(module, monitor, options):
try:
kwargs = dict(id=monitor['id'], query=module.params['query'],
name=module.params['name'], message=_fix_template_vars(module.params['message']),
name=_fix_template_vars(module.params['name']),
message=_fix_template_vars(module.params['message']),
escalation_message=_fix_template_vars(module.params['escalation_message']),
options=options)
if module.params['tags'] is not None:
kwargs['tags'] = module.params['tags']