Skip to content

No way to debug templates over salt-ssh #50196

@max-arnold

Description

@max-arnold

Description of Issue/Question

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)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Salt-SSHbugbroken, incorrect, or confusing behaviorseverity-medium3rd level, incorrect or bad functionality, confusing and lacks a work around

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions