You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# /srv/salt/jinja_cache.jinja{% set myvar = "hello" -%}
Steps to Reproduce the behavior
Applying the state file as-is produces the expected "hello" notification:
# salt-call state.apply jinja_cache
local:
----------
ID: test
Function: test.show_notification
Result: True
Comment: hello
Started: 21:19:26.078569
Duration: 0.329 ms
Changes:
Summary forlocal
------------
Succeeded: 1
Failed: 0
------------
Total states run: 1
Total run time: 0.329 ms
...and changing the variable text like so:
{% set myvar = "world" -%}
...results in a changed notification text to match "world" from the variable as expected:
# salt-call state.apply jinja_cache
local:
----------
ID: test
Function: test.show_notification
Result: True
Comment: world
Started: 21:19:37.647817
Duration: 0.894 ms
Changes:
Summary forlocal
------------
Succeeded: 1
Failed: 0
------------
Total states run: 1
Total run time: 0.894 ms
However, removing the included jinja file after it has already been cached can result in the file being loaded from cache despite no longer being present on the Salt filesystem:
# mv jinja_cache.jinja{,.bak}
# salt-call state.apply jinja_cache
local:
----------
ID: test
Function: test.show_notification
Result: True
Comment: world
Started: 21:22:55.004962
Duration: 0.386 ms
Changes:
Summary forlocal
------------
Succeeded: 1
Failed: 0
------------
Total states run: 1
Total run time: 0.386 ms
Expected behavior
After the Jinja file is removed from the Salt filesystem, the state should failed to run with a TemplateNotFound error. Loading cached files can result in user surprise when complex map loading decisions are made.
Versions Report
salt --versions-report
(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
Salt Version:
Salt: 3004.1Dependency Versions:
cffi: Not Installedcherrypy: Not Installeddateutil: 2.7.3docker-py: Not Installedgitdb: 2.0.5gitpython: 2.1.11Jinja2: 2.10libgit2: Not InstalledM2Crypto: Not InstalledMako: Not Installedmsgpack: 0.5.6msgpack-pure: Not Installedmysql-python: Not Installedpycparser: Not Installedpycrypto: 2.6.1pycryptodome: 3.6.1pygit2: Not InstalledPython: 3.7.3 (default, Jan 22 2021, 20:04:44)python-gnupg: Not InstalledPyYAML: 3.13PyZMQ: 17.1.2smmap: 2.0.5timelib: Not InstalledTornado: 4.5.3ZMQ: 4.3.1System Versions:
dist: debian 10 busterlocale: UTF-8machine: x86_64release: 4.19.0-20-amd64system: Linuxversion: Debian GNU/Linux 10 buster
The text was updated successfully, but these errors were encountered:
Description
Found a bug where an included Jinja template can still be loaded from the cache despite being removed from the Salt filesystem.
Setup
Create two test files on the Salt filesystem:
Steps to Reproduce the behavior
Applying the state file as-is produces the expected "hello" notification:
...and changing the variable text like so:
{% set myvar = "world" -%}
...results in a changed notification text to match "world" from the variable as expected:
However, removing the included jinja file after it has already been cached can result in the file being loaded from cache despite no longer being present on the Salt filesystem:
# mv jinja_cache.jinja{,.bak}
Expected behavior
After the Jinja file is removed from the Salt filesystem, the state should failed to run with a
TemplateNotFound
error. Loading cached files can result in user surprise when complex map loading decisions are made.Versions Report
salt --versions-report
(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)The text was updated successfully, but these errors were encountered: