Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

salt rendering #129

Open
srikanth-2 opened this issue Apr 20, 2021 · 1 comment
Open

salt rendering #129

srikanth-2 opened this issue Apr 20, 2021 · 1 comment

Comments

@srikanth-2
Copy link

srikanth-2 commented Apr 20, 2021

I am experiencing an issue when trying to assign a value(icinga_ticket) on my post http query request.
Have the fqdn value set from grain

Below is how it is defined in my state

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

Error:
Rendering SLS 'base:icinga.icinga2_core' failed: Jinja error: 'str' object does not support item assignment
Traceback (most recent call last):

But when i execute the below command through cli it works fine.

salt-call http.query https://ticket-generator.az.dev.opd.com method=POST header_dict='{"Content-Type":"application/json"}' data="'{"hostname": "minion.node.dev.opd.com"}'" backend=requests
local:
----------
body:
{"icinga_ticket":"7609f6bc84d97748e15df9436aab07fbf48756d3"}

@mxrss2
Copy link

mxrss2 commented Apr 21, 2021

@srikanth-2 you need to fix a few things

{% set fqdn = salt['grains.get']('grain-here') %}
{% set data = { 'hostname':fqdn } %}
{% set icinga_ticket = salt['http.query']('https://ticket-generator.az.dev.opd.com', method='POST', header_dict='{"Content-Type":"application/json"}', data=data, backend='requests') %} 


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants