Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] When running with salt-ssh, getting error that 'opts' is not defined. #201

Closed
cr1st1p opened this issue Aug 22, 2021 · 2 comments
Closed
Labels

Comments

@cr1st1p
Copy link

cr1st1p commented Aug 22, 2021

Your setup

Formula commit hash / release tag

git master branch, commit hash d48bdde

Versions reports (master & minion)

Salt Version:
Salt: 3002.2

Dependency Versions:
cffi: 1.14.6
cherrypy: Not Installed
dateutil: 2.8.1
docker-py: 5.0.0
gitdb: 4.0.7
gitpython: 3.1.18
Jinja2: 3.0.1
libgit2: Not Installed
M2Crypto: Not Installed
Mako: 1.1.4
msgpack: 1.0.2
msgpack-pure: Not Installed
mysql-python: Not Installed
pycparser: 2.20
pycrypto: Not Installed
pycryptodome: 3.10.1
pygit2: Not Installed
Python: 3.9.6 (default, Jun 30 2021, 10:22:16)
python-gnupg: Not Installed
PyYAML: 5.4.1
PyZMQ: 22.1.0
smmap: 4.0.0
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.3.4

System Versions:
dist: manjaro 21.1.0 Pahvo
locale: utf-8
machine: x86_64
release: 5.4.135-1-MANJARO
system: Linux
version: Manjaro Linux 21.1.0 Pahvo

Pillar / config used


Bug details

Describe the bug

Trying to run a state.highstate via salt-ssh, and among others, using this formula.
I get an exception:
...
[DEBUG ] In saltenv 'base', looking at rel_path 'openssh/libsaltcli.jinja' to resolve 'salt://openssh/libsaltcli.jinja'
[DEBUG ] In saltenv 'base', ** considering ** path '/var/tmp/.root_9669d5_salt/running_data/var/cache/salt/minion/files/base/openssh/libsaltcli.jinja' to resolve 'salt://openssh/libsaltcli.jinja'
[ERROR ] Rendering exception occurred
Traceback (most recent call last):
File "/usr/lib/python3.9/site-packages/salt/utils/templates.py", line 495, in render_jinja_tmpl
output = template.render(**decoded_context)
File "/usr/lib/python3.9/site-packages/jinja2/environment.py", line 1304, in render
self.environment.handle_exception()
File "/usr/lib/python3.9/site-packages/jinja2/environment.py", line 925, in handle_exception
raise rewrite_traceback_stack(source=source)
File "", line 1, in top-level template code
File "/usr/lib/python3.9/site-packages/jinja2/environment.py", line 1412, in make_module
return TemplateModule(self, ctx)
File "/usr/lib/python3.9/site-packages/jinja2/environment.py", line 1542, in init
body_stream = list(template.root_render_func(context)) # type: ignore
File "/var/tmp/.root_9669d5_salt/running_data/var/cache/salt/minion/files/base/openssh/map.jinja", line 6, in top-level template code
{%- from tplroot ~ "/libmapstack.jinja" import mapstack %}
File "/usr/lib/python3.9/site-packages/jinja2/environment.py", line 1412, in make_module
return TemplateModule(self, ctx)
File "/usr/lib/python3.9/site-packages/jinja2/environment.py", line 1542, in init
body_stream = list(template.root_render_func(context)) # type: ignore
File "/var/tmp/.root_9669d5_salt/running_data/var/cache/salt/minion/files/base/openssh/libmapstack.jinja", line 6, in top-level template code
{%- from tplroot ~ "/libmatchers.jinja" import parse_matchers, query_map %}
File "/usr/lib/python3.9/site-packages/jinja2/environment.py", line 1412, in make_module
return TemplateModule(self, ctx)
File "/usr/lib/python3.9/site-packages/jinja2/environment.py", line 1542, in init
body_stream = list(template.root_render_func(context)) # type: ignore
File "/var/tmp/.root_9669d5_salt/running_data/var/cache/salt/minion/files/base/openssh/libmatchers.jinja", line 6, in top-level template code
{%- from tplroot ~ "/libsaltcli.jinja" import cli %}
File "/usr/lib/python3.9/site-packages/jinja2/environment.py", line 1412, in make_module
return TemplateModule(self, ctx)
File "/usr/lib/python3.9/site-packages/jinja2/environment.py", line 1542, in init
body_stream = list(template.root_render_func(context)) # type: ignore
File "/var/tmp/.root_9669d5_salt/running_data/var/cache/salt/minion/files/base/openssh/libsaltcli.jinja", line 5, in top-level template code
{%- set opts_cli = opts.get('__cli', '') %}
File "/usr/lib/python3.9/site-packages/jinja2/environment.py", line 474, in getattr
return getattr(obj, attribute)
jinja2.exceptions.UndefinedError: 'opts' is undefined

Steps to reproduce the bug

I guess just try using this formula and run it with salt-ssh.

Expected behaviour

To work correctly when running via salt-ssh as well.
Note: months ago, when running it via salt-master/minion, it worked ok. But I want to run it now agentless.

Attempts to fix the bug

None.

Additional context

none

@cr1st1p cr1st1p added the bug label Aug 22, 2021
@myii
Copy link
Member

myii commented Aug 22, 2021

@cr1st1p You're hitting this regression: saltstack/salt#60188 (comment). I've linked to the comment which contains the current workaround of downgrading Jinja2.

@alxwr
Copy link
Member

alxwr commented Feb 8, 2024

As @myii said, this is a regression. I'll close this issue.

@alxwr alxwr closed this as completed Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants