The recommended ways to debug templates are (as seen in the Slack chat):
salt 'example.com' slsutil.renderer /path/to/file.jinja 'jinja'
salt 'example.com' cp.get_template salt://path/to/template /dev/stdout template=jinja
Unfortunately, I was unable to make it work over salt-ssh:
salt-ssh -l debug example.com slsutil.renderer path='salt://test.sls' default_renderer='jinja'
...
[DEBUG ] Could not LazyLoad slsutil.renderer: 'slsutil.renderer' is not available.
...
salt-ssh example.com cp.get_template salt://test.sls /dev/stdout template=jinja
example.com:
----------
retcode:
0
stderr:
Traceback (most recent call last):
File "/var/tmp/.root_7e26e1_salt/salt-call", line 15, in <module>
salt_call()
File "/var/tmp/.root_7e26e1_salt/py3/salt/scripts.py", line 400, in salt_call
client.run()
File "/var/tmp/.root_7e26e1_salt/py3/salt/cli/call.py", line 57, in run
caller.run()
File "/var/tmp/.root_7e26e1_salt/py3/salt/cli/caller.py", line 134, in run
ret = self.call()
File "/var/tmp/.root_7e26e1_salt/py3/salt/cli/caller.py", line 212, in call
ret['return'] = func(*args, **kwargs)
File "/var/tmp/.root_7e26e1_salt/py3/salt/modules/cp.py", line 335, in get_template
**kwargs)
File "/var/tmp/.root_7e26e1_salt/py3/salt/fileclient.py", line 782, in get_template
**kwargs
File "/var/tmp/.root_7e26e1_salt/py3/salt/utils/templates.py", line 167, in render_tmpl
tmplstr = tmplsrc.read()
AttributeError: 'bool' object has no attribute 'read'
stdout:
Third way also doesn't work:
salt-ssh example.com cp.get_file salt://test.sls /dev/stdout template=jinja
example.com:
False
Salt version 2018.3.2 on Py3.
The question is: what is the best (and documented) way to debug templates, which works consistently across salt, salt-call and salt-ssh (and maybe salt-run)?
@max-arnold Thank you for reporting this.
Any clues on how to fix this?
.venv โฏ salt --version
salt 2019.2.0 (Fluorine)
I faced this problem yesterday. It highly impacts local development process.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.
Still valid
Thank you for updating this issue. It is no longer marked as stale.
I can work on a fix if the @dwoz or someone at Salt can offer some guidance.
@amendlik looking to find someone who can give that guidance, thank you!
Most helpful comment
I faced this problem yesterday. It highly impacts local development process.