saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Get access to the Salt software package repository here:
https://repo.saltproject.io/
Apache License 2.0
14.11k stars 5.47k forks source link

slsutil.findup does not work with salt-ssh #61143

Open baby-gnu opened 2 years ago

baby-gnu commented 2 years ago

Description

In version 3004 the slsutil.findup is added and wanted to try it with salt-ssh but it does not work.

Setup

Two identical Debian machines, testmachine5 and testmachine6:

lsb_release -a The same on the machine with salt-ssh and the target ``` Distributor ID: Debian Description: Debian GNU/Linux 11 (bullseye) Release: 11 Codename: bullseye ```

With salt-ssh package from https://repo.saltproject.io/py3/debian/11/amd64/archive/3004 installed on testmachine5.

Please be as specific as possible and give set-up details.

Steps to Reproduce the behavior

On the salt-ssh machine named testmachine5, create the following files:

/srv/salt/test-import/map.jinja ```sls {#- -*- mode: jinja; coding: utf-8 -*- #} {% set mapdata = {"test": "foo"} %} ```
/srv/salt/test-import/findup.sls ```sls # -*- mode: salt; coding: utf-8 -*- # vim: ft=sls {% from salt["slsutil.findup"](tplfile, "map.jinja") import mapdata %} test-import/findup/test.nop: test.nop: - name: {{ mapdata | json }} ```
/etc/salt/roster ``` # -*- yaml -*- testmachine6: host: 192.168.0.111 user: root ```

I try to execute either the .sls

salt-ssh testmachine6 state.apply test-import.findup ``` [ERROR ] Rendering exception occurred Traceback (most recent call last): File "/usr/lib/python3/dist-packages/salt/utils/templates.py", line 502, in render_jinja_tmpl output = template.render(**decoded_context) File "/usr/lib/python3/dist-packages/jinja2/environment.py", line 1090, in render self.environment.handle_exception() File "/usr/lib/python3/dist-packages/jinja2/environment.py", line 832, in handle_exception reraise(*rewrite_traceback_stack(source=source)) File "/usr/lib/python3/dist-packages/jinja2/_compat.py", line 28, in reraise raise value.with_traceback(tb) File "