You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
release tag v2.5.0 (1920340)
Also v2.6.0 - v2.7.0 have the same problem.
Versions reports (master & minion)
Salt Version:
Salt: 3001.4
Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: 2.7.3
docker-py: Not Installed
gitdb: 2.0.6
gitpython: 3.0.7
Jinja2: 2.10.1
libgit2: Not Installed
M2Crypto: Not Installed
Mako: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.6.2
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: 2.6.1
pycryptodome: 3.6.1
pygit2: Not Installed
Python: 3.8.5 (default, Jul 28 2020, 12:59:40)
python-gnupg: 0.4.5
PyYAML: 5.3.1
PyZMQ: 18.1.1
smmap: 2.0.5
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.3.2
System Versions:
dist: ubuntu 20.04 focal
locale: utf-8
machine: x86_64
release: 5.4.0-58-generic
system: Linux
version: Ubuntu 20.04 focal
Pillar / config used
servers_config.sls and snippets.sls from latest release 2.5.0
Bug details
Describe the bug
servers_config.sls and nginx.snippets fail to render in v2.5.0 because of unsupported comparison between 'int' and 'str':
Rendering SLS 'base:nginx.servers' failed: Jinja error: '<' not supported between instances of 'str' and 'int'
/var/cache/salt/minion/files/base/nginx/servers_config.sls(133):
---
[...]
- require_in:
- service: nginx_service
{% if 'source_path' not in settings.config %}
- context:
config: {{ settings.config|json(sort_keys=False) }}
nginx: {{ _nginx|json() }} <======================
{% endif %}
{% if 'overwrite' in settings and settings.overwrite == False %}
- unless:
- test -e {{ server_curpath(server) }}
{% endif %}
[...]
---
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/salt/utils/templates.py", line 400, in render_jinja_tmpl
output = template.render(**decoded_context)
File "/usr/lib/python3/dist-packages/jinja2/asyncsupport.py", line 76, in render
return original_render(self, *args, **kwargs)
File "/usr/lib/python3/dist-packages/jinja2/environment.py", line 1008, in render
return self.environment.handle_exception(exc_info, True)
File "/usr/lib/python3/dist-packages/jinja2/environment.py", line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File "/usr/lib/python3/dist-packages/jinja2/_compat.py", line 37, in reraise
raise value.with_traceback(tb)
File "<template>", line 7, in <module>
File "/usr/lib/python3/dist-packages/jinja2/environment.py", line 1073, in make_module
return TemplateModule(self, self.new_context(vars, shared, locals))
File "/usr/lib/python3/dist-packages/jinja2/environment.py", line 1152, in __init__
body_stream = list(template.root_render_func(context))
File "/var/cache/salt/minion/files/base/nginx/servers_config.sls", line 133, in <module>
nginx: {{ _nginx|json() }}
File "/usr/lib/python3/dist-packages/salt/utils/jinja.py", line 940, in format_json
json_txt = salt.utils.json.dumps(
File "/usr/lib/python3/dist-packages/salt/utils/json.py", line 149, in dumps
return json_module.dumps(obj, **kwargs) # future lint: blacklisted-function
File "/usr/lib/python3.8/json/__init__.py", line 234, in dumps
return cls(
File "/usr/lib/python3.8/json/encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/lib/python3.8/json/encoder.py", line 257, in iterencode
return _iterencode(o, 0)
TypeError: '<' not supported between instances of 'str' and 'int'
Steps to reproduce the bug
git checkout v2.5.0
salt state.apply nginx.config,nginx.servers
Expected behaviour
state.apply run sucessfully
Attempts to fix the bug
For me it worked with json(sort_keys=False)
The text was updated successfully, but these errors were encountered:
Your setup
Formula commit hash / release tag
release tag v2.5.0 (1920340)
Also v2.6.0 - v2.7.0 have the same problem.
Versions reports (master & minion)
Salt Version:
Salt: 3001.4
Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: 2.7.3
docker-py: Not Installed
gitdb: 2.0.6
gitpython: 3.0.7
Jinja2: 2.10.1
libgit2: Not Installed
M2Crypto: Not Installed
Mako: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.6.2
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: 2.6.1
pycryptodome: 3.6.1
pygit2: Not Installed
Python: 3.8.5 (default, Jul 28 2020, 12:59:40)
python-gnupg: 0.4.5
PyYAML: 5.3.1
PyZMQ: 18.1.1
smmap: 2.0.5
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.3.2
System Versions:
dist: ubuntu 20.04 focal
locale: utf-8
machine: x86_64
release: 5.4.0-58-generic
system: Linux
version: Ubuntu 20.04 focal
Pillar / config used
servers_config.sls and snippets.sls from latest release 2.5.0
Bug details
Describe the bug
servers_config.sls and nginx.snippets fail to render in v2.5.0 because of unsupported comparison between 'int' and 'str':
Steps to reproduce the bug
git checkout v2.5.0
salt state.apply nginx.config,nginx.servers
Expected behaviour
state.apply run sucessfully
Attempts to fix the bug
For me it worked with
json(sort_keys=False)
The text was updated successfully, but these errors were encountered: