How to fix rendering SLS failed: Jinja syntax error: expected token ',', got ':'?

1.3k views Asked by At

I have a particular error on this line:

 {% set icinga_ticket = salt['http.query'](https://ticket-generator.az.dev.com method=POST header_dict='{"Content-Type":"application/json"}' data="'{\"hostname\": \"minion.node.jio.com\"}'" backend=requests) %}

I got:

rendering SLS 'base:icinga.icinga2_core' failed: Jinja syntax error: expected token ',', got ':'

How to solve this error?

1

There are 1 answers

0
SynPrime On

Try to separate the options with , and quote non variables like this: method='POST'.

 {% set icinga_ticket = salt['http.query']('https://ticket-generator.az.dev.com', method='POST', header_dict='{"Content-Type":"application/json"}', data="'{\"hostname\": \"minion.node.jio.com\"}'", backend='requests') %}

Btw have a look at the icinga2 module: https://docs.saltproject.io/en/latest/ref/modules/all/salt.modules.icinga2.html#salt.modules.icinga2.generate_ticket