salt
salt copied to clipboard
[BUG] [3007] Problem running salt function in Jinja template: Cannot run the event loop while another loop is running
Description Having a jinja block with a salt function inside a pillar, the error appears and pillar won't get rendered.
Setup
{%- set something = salt['http.query']('http://example.com', raise_error=False, verify_ssl=False, status=True, timeout=5) %}
{%- if something.status == 200 %}
something: True
{%- endif %}
throws:
Problem running salt function in Jinja template: Cannot run the event loop while another loop is running
Steps to Reproduce the behavior
Create a pillar with salt function.
Expected behavior
Pillar gets rendered.
Versions Report
salt --versions-report
(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)Salt Version:
Salt: 3007.1
Python Version:
Python: 3.10.14 (main, Apr 3 2024, 21:33:04) [GCC 11.2.0]
Dependency Versions:
cffi: 1.16.0
cherrypy: unknown
dateutil: 2.8.2
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 3.1.4
libgit2: Not Installed
looseversion: 1.3.0
M2Crypto: Not Installed
Mako: Not Installed
msgpack: 1.0.7
msgpack-pure: Not Installed
mysql-python: Not Installed
packaging: 23.1
pycparser: 2.21
pycrypto: Not Installed
pycryptodome: 3.19.1
pygit2: Not Installed
python-gnupg: 0.5.2
PyYAML: 6.0.1
PyZMQ: 25.1.2
relenv: 0.16.0
smmap: Not Installed
timelib: 0.3.0
Tornado: 6.3.3
ZMQ: 4.3.4
Salt Package Information:
Package Type: onedir
System Versions:
dist: ubuntu 24.04 noble
locale: utf-8
machine: aarch64
release: 6.8.0-31-generic
system: Linux
version: Ubuntu 24.04 noble
Additional context
Looks like #66330 solves the issue
Hi there! Welcome to the Salt Community! Thank you for making your first contribution. We have a lengthy process for issues and PRs. Someone from the Core Team will follow up as soon as possible. In the meantime, here’s some information that may help as you continue your Salt journey. Please be sure to review our Code of Conduct. Also, check out some of our community resources including:
- Community Wiki
- Salt’s Contributor Guide
- Join our Community Slack
- IRC on LiberaChat
- Salt Project YouTube channel
- Salt Project Twitch channel
There are lots of ways to get involved in our community. Every month, there are around a dozen opportunities to meet with other contributors and the Salt Core team and collaborate in real time. The best way to keep track is by subscribing to the Salt Community Events Calendar. If you have additional questions, email us at [email protected]. We’re glad you’ve joined our community and look forward to doing awesome things with you!
thanks @morph027. I hadn't realized that the normal pillar was also affected. this made it easier to write a test case for @krombel's open PR.