-
Notifications
You must be signed in to change notification settings - Fork 84
Open
Labels
Description
Your setup
Formula commit hash / release tag
v1.2.1
Versions reports (master & minion)
salt --versions-report
Salt Version:
Salt: 3005.1
Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: 2.8.2
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 3.0.3
libgit2: 1.5.0
M2Crypto: Not Installed
Mako: Not Installed
msgpack: 1.0.3
msgpack-pure: Not Installed
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: Not Installed
pycryptodome: 3.11.0
pygit2: 1.11.1
Python: 3.10.9 (main, Dec 7 2022, 13:47:07) [GCC 12.2.0]
python-gnupg: Not Installed
PyYAML: 6.0
PyZMQ: 24.0.1
smmap: Not Installed
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.3.4
System Versions:
dist: debian n/a bookworm
locale: utf-8
machine: x86_64
release: 6.0.0-6-amd64
system: Linux
version: Debian GNU/Linux n/a bookworm
Pillar / config used
None
Bug details
Describe the bug
When I try to run collectd.disk with salt-ssh, I get a jinja2.exceptions.TemplateNotFound: collectd/map.jinja
Steps to reproduce the bug
salt-ssh 'vm-106' state.apply collectd.disk test=True
vm-106:
----------
ID: collectd
Function: pkg.installed
Name: collectd-core
Result: None
Comment: The following packages would be installed/updated: collectd-core
Started: 08:49:48.652548
Duration: 67.392 ms
Changes:
----------
collectd-core:
----------
new:
installed
old:
----------
ID: /etc/collectd/plugins
Function: file.directory
Result: None
Comment: The following files will be changed:
/etc/collectd/plugins: directory - new
Started: 08:49:48.723995
Duration: 5.262 ms
Changes:
----------
/etc/collectd/plugins:
----------
directory:
new
----------
ID: /etc/collectd/plugins/disk.conf
Function: file.managed
Result: False
Comment: An exception occurred in this state: Traceback (most recent call last):
File "/var/tmp/.root_8dccac_salt/pyall/salt/utils/templates.py", line 469, in render_jinja_tmpl
output = template.render(**decoded_context)
File "/var/tmp/.root_8dccac_salt/pyall/jinja2/environment.py", line 1291, in render
self.environment.handle_exception()
File "/var/tmp/.root_8dccac_salt/pyall/jinja2/environment.py", line 925, in handle_exception
raise rewrite_traceback_stack(source=source)
File "<template>", line 1, in top-level template code
File "/var/tmp/.root_8dccac_salt/pyall/salt/utils/jinja.py", line 221, in get_source
raise TemplateNotFound(template)
jinja2.exceptions.TemplateNotFound: collectd/map.jinja
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/var/tmp/.root_8dccac_salt/pyall/salt/state.py", line 2276, in call
ret = self.states[cdata["full"]](
File "/var/tmp/.root_8dccac_salt/pyall/salt/loader/lazy.py", line 149, in __call__
return self.loader.run(run_func, *args, **kwargs)
File "/var/tmp/.root_8dccac_salt/pyall/salt/loader/lazy.py", line 1228, in run
return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
File "/var/tmp/.root_8dccac_salt/pyall/salt/loader/lazy.py", line 1243, in _run_as
return _func_or_method(*args, **kwargs)
File "/var/tmp/.root_8dccac_salt/pyall/salt/loader/lazy.py", line 1276, in wrapper
return f(*args, **kwargs)
File "/var/tmp/.root_8dccac_salt/pyall/salt/states/file.py", line 3100, in managed
ret["changes"] = __salt__["file.check_managed_changes"](
File "/var/tmp/.root_8dccac_salt/pyall/salt/loader/lazy.py", line 149, in __call__
return self.loader.run(run_func, *args, **kwargs)
File "/var/tmp/.root_8dccac_salt/pyall/salt/loader/lazy.py", line 1228, in run
return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
File "/var/tmp/.root_8dccac_salt/pyall/salt/loader/lazy.py", line 1243, in _run_as
return _func_or_method(*args, **kwargs)
File "/var/tmp/.root_8dccac_salt/pyall/salt/modules/file.py", line 5475, in check_managed_changes
sfn, source_sum, comments = get_managed(
File "/var/tmp/.root_8dccac_salt/pyall/salt/modules/file.py", line 4713, in get_managed
data = salt.utils.templates.TEMPLATE_REGISTRY[template](
File "/var/tmp/.root_8dccac_salt/pyall/salt/utils/templates.py", line 216, in render_tmpl
output = render_str(tmplstr, context, tmplpath)
File "/var/tmp/.root_8dccac_salt/pyall/salt/utils/templates.py", line 513, in render_jinja_tmpl
raise SaltRenderError(
salt.exceptions.SaltRenderError: Jinja error: collectd/map.jinja
Traceback (most recent call last):
File "/var/tmp/.root_8dccac_salt/pyall/salt/utils/templates.py", line 469, in render_jinja_tmpl
output = template.render(**decoded_context)
File "/var/tmp/.root_8dccac_salt/pyall/jinja2/environment.py", line 1291, in render
self.environment.handle_exception()
File "/var/tmp/.root_8dccac_salt/pyall/jinja2/environment.py", line 925, in handle_exception
raise rewrite_traceback_stack(source=source)
File "<template>", line 1, in top-level template code
File "/var/tmp/.root_8dccac_salt/pyall/salt/utils/jinja.py", line 221, in get_source
raise TemplateNotFound(template)
jinja2.exceptions.TemplateNotFound: collectd/map.jinja
; line 1
---
{%- from "collectd/map.jinja" import collectd_settings with context %} <======================
#
# DO NOT EDIT
#
# This file is managed by salt via {{ source }}
# Modify the config that generates this file instead
[...]
---
Started: 08:49:48.729393
Duration: 56.021 ms
Changes:
----------
ID: /etc/collectd/collectd.conf
Function: file.managed
Result: False
Comment: An exception occurred in this state: Traceback (most recent call last):
File "/var/tmp/.root_8dccac_salt/pyall/salt/utils/templates.py", line 469, in render_jinja_tmpl
output = template.render(**decoded_context)
File "/var/tmp/.root_8dccac_salt/pyall/jinja2/environment.py", line 1291, in render
self.environment.handle_exception()
File "/var/tmp/.root_8dccac_salt/pyall/jinja2/environment.py", line 925, in handle_exception
raise rewrite_traceback_stack(source=source)
File "<template>", line 1, in top-level template code
File "/var/tmp/.root_8dccac_salt/pyall/salt/utils/jinja.py", line 221, in get_source
raise TemplateNotFound(template)
jinja2.exceptions.TemplateNotFound: collectd/map.jinja
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/var/tmp/.root_8dccac_salt/pyall/salt/state.py", line 2276, in call
ret = self.states[cdata["full"]](
File "/var/tmp/.root_8dccac_salt/pyall/salt/loader/lazy.py", line 149, in __call__
return self.loader.run(run_func, *args, **kwargs)
File "/var/tmp/.root_8dccac_salt/pyall/salt/loader/lazy.py", line 1228, in run
return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
File "/var/tmp/.root_8dccac_salt/pyall/salt/loader/lazy.py", line 1243, in _run_as
return _func_or_method(*args, **kwargs)
File "/var/tmp/.root_8dccac_salt/pyall/salt/loader/lazy.py", line 1276, in wrapper
return f(*args, **kwargs)
File "/var/tmp/.root_8dccac_salt/pyall/salt/states/file.py", line 3100, in managed
ret["changes"] = __salt__["file.check_managed_changes"](
File "/var/tmp/.root_8dccac_salt/pyall/salt/loader/lazy.py", line 149, in __call__
return self.loader.run(run_func, *args, **kwargs)
File "/var/tmp/.root_8dccac_salt/pyall/salt/loader/lazy.py", line 1228, in run
return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
File "/var/tmp/.root_8dccac_salt/pyall/salt/loader/lazy.py", line 1243, in _run_as
return _func_or_method(*args, **kwargs)
File "/var/tmp/.root_8dccac_salt/pyall/salt/modules/file.py", line 5475, in check_managed_changes
sfn, source_sum, comments = get_managed(
File "/var/tmp/.root_8dccac_salt/pyall/salt/modules/file.py", line 4713, in get_managed
data = salt.utils.templates.TEMPLATE_REGISTRY[template](
File "/var/tmp/.root_8dccac_salt/pyall/salt/utils/templates.py", line 216, in render_tmpl
output = render_str(tmplstr, context, tmplpath)
File "/var/tmp/.root_8dccac_salt/pyall/salt/utils/templates.py", line 513, in render_jinja_tmpl
raise SaltRenderError(
salt.exceptions.SaltRenderError: Jinja error: collectd/map.jinja
Traceback (most recent call last):
File "/var/tmp/.root_8dccac_salt/pyall/salt/utils/templates.py", line 469, in render_jinja_tmpl
output = template.render(**decoded_context)
File "/var/tmp/.root_8dccac_salt/pyall/jinja2/environment.py", line 1291, in render
self.environment.handle_exception()
File "/var/tmp/.root_8dccac_salt/pyall/jinja2/environment.py", line 925, in handle_exception
raise rewrite_traceback_stack(source=source)
File "<template>", line 1, in top-level template code
File "/var/tmp/.root_8dccac_salt/pyall/salt/utils/jinja.py", line 221, in get_source
raise TemplateNotFound(template)
jinja2.exceptions.TemplateNotFound: collectd/map.jinja
; line 1
---
{%- from "collectd/map.jinja" import collectd_settings with context %} <======================
#
# DO NOT EDIT
#
# This file is managed by salt via {{ source }}
# Modify the config that generates this file instead
[...]
---
Started: 08:49:48.785568
Duration: 7.819 ms
Changes:
----------
ID: /etc/collectd/plugins/default.conf
Function: file.managed
Result: False
Comment: An exception occurred in this state: Traceback (most recent call last):
File "/var/tmp/.root_8dccac_salt/pyall/salt/utils/templates.py", line 469, in render_jinja_tmpl
output = template.render(**decoded_context)
File "/var/tmp/.root_8dccac_salt/pyall/jinja2/environment.py", line 1291, in render
self.environment.handle_exception()
File "/var/tmp/.root_8dccac_salt/pyall/jinja2/environment.py", line 925, in handle_exception
raise rewrite_traceback_stack(source=source)
File "<template>", line 1, in top-level template code
File "/var/tmp/.root_8dccac_salt/pyall/salt/utils/jinja.py", line 221, in get_source
raise TemplateNotFound(template)
jinja2.exceptions.TemplateNotFound: collectd/map.jinja
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/var/tmp/.root_8dccac_salt/pyall/salt/state.py", line 2276, in call
ret = self.states[cdata["full"]](
File "/var/tmp/.root_8dccac_salt/pyall/salt/loader/lazy.py", line 149, in __call__
return self.loader.run(run_func, *args, **kwargs)
File "/var/tmp/.root_8dccac_salt/pyall/salt/loader/lazy.py", line 1228, in run
return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
File "/var/tmp/.root_8dccac_salt/pyall/salt/loader/lazy.py", line 1243, in _run_as
return _func_or_method(*args, **kwargs)
File "/var/tmp/.root_8dccac_salt/pyall/salt/loader/lazy.py", line 1276, in wrapper
return f(*args, **kwargs)
File "/var/tmp/.root_8dccac_salt/pyall/salt/states/file.py", line 3100, in managed
ret["changes"] = __salt__["file.check_managed_changes"](
File "/var/tmp/.root_8dccac_salt/pyall/salt/loader/lazy.py", line 149, in __call__
return self.loader.run(run_func, *args, **kwargs)
File "/var/tmp/.root_8dccac_salt/pyall/salt/loader/lazy.py", line 1228, in run
return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
File "/var/tmp/.root_8dccac_salt/pyall/salt/loader/lazy.py", line 1243, in _run_as
return _func_or_method(*args, **kwargs)
File "/var/tmp/.root_8dccac_salt/pyall/salt/modules/file.py", line 5475, in check_managed_changes
sfn, source_sum, comments = get_managed(
File "/var/tmp/.root_8dccac_salt/pyall/salt/modules/file.py", line 4713, in get_managed
data = salt.utils.templates.TEMPLATE_REGISTRY[template](
File "/var/tmp/.root_8dccac_salt/pyall/salt/utils/templates.py", line 216, in render_tmpl
output = render_str(tmplstr, context, tmplpath)
File "/var/tmp/.root_8dccac_salt/pyall/salt/utils/templates.py", line 513, in render_jinja_tmpl
raise SaltRenderError(
salt.exceptions.SaltRenderError: Jinja error: collectd/map.jinja
Traceback (most recent call last):
File "/var/tmp/.root_8dccac_salt/pyall/salt/utils/templates.py", line 469, in render_jinja_tmpl
output = template.render(**decoded_context)
File "/var/tmp/.root_8dccac_salt/pyall/jinja2/environment.py", line 1291, in render
self.environment.handle_exception()
File "/var/tmp/.root_8dccac_salt/pyall/jinja2/environment.py", line 925, in handle_exception
raise rewrite_traceback_stack(source=source)
File "<template>", line 1, in top-level template code
File "/var/tmp/.root_8dccac_salt/pyall/salt/utils/jinja.py", line 221, in get_source
raise TemplateNotFound(template)
jinja2.exceptions.TemplateNotFound: collectd/map.jinja
; line 1
---
{%- from "collectd/map.jinja" import collectd_settings with context %} <======================
#
# DO NOT EDIT
#
# This file is managed by salt via {{ source }}
# Modify the config that generates this file instead
[...]
---
Started: 08:49:48.793519
Duration: 6.003 ms
Changes:
----------
ID: collectd-service
Function: service.running
Name: collectd
Result: False
Comment: One or more requisite failed: collectd./etc/collectd/plugins/default.conf, collectd./etc/collectd/collectd.conf, collectd.disk./etc/collectd/plugins/disk.conf
Started: 08:49:48.810224
Duration: 0.005 ms
Changes:
Summary for vm-106
------------
Succeeded: 2 (unchanged=2, changed=2)
Failed: 4
------------
Total states run: 6
Total run time: 142.502 ms
Expected behaviour
The state show run without any error
Attempts to fix the bug
As mentioned in 21370, a workaround is to create a new state to cache include and import files.
I'll submit a PR to workaround that bug.