When Jinja reads a context dictionary, can it read values changed in time?

7 views
Skip to first unread message

Markus Kramer

unread,
Nov 22, 2018, 8:35:19 AM11/22/18
to pocoo-libs
From the docs: 


Saltstack uses Jijna and passes a dictionary called 'grains'.


A Jijna program changes that dictionary.


{% set mygrain_point_in_time1 = grains['mygrain'] %}

{# Change the mygrain key in the grain dictionary #}

{% set mygrain_point_in_time2 = grains['mygrain'] %}

Problem: the second variable has the old, unchanged value.


When does Jijna actually read the context dictionary in the two assigment: 
  - Once at rendering time?
  - Twice, at assigment execution?

If Jinja reads the context dictionary at assigment execution time:
  Can the dictionary be passed a reference?

To sum up the questions: 
  When Jinja reads a context dictionary, can it read values changed in time?



Reply all
Reply to author
Forward
0 new messages