saltstack-formulas / salt-formula

Yes, Salt can Salt itself!

Home Page:http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] state salt.minion failing if config version not present

vveliev-tc opened this issue · comments

Your setup

Formula commit hash / release tag

v1.11.0

Versions reports (master & minion)

Salt Version:
Salt: 3004.2

Dependency Versions:
cffi: 1.15.1
cherrypy: Not Installed
dateutil: 2.8.1
docker-py: Not Installed
gitdb: 4.0.5
gitpython: 3.1.14
Jinja2: 2.11.3
libgit2: 1.4.1
M2Crypto: Not Installed
Mako: Not Installed
msgpack: 1.0.0
msgpack-pure: Not Installed
mysql-python: Not Installed
pycparser: 2.21
pycrypto: Not Installed
pycryptodome: 3.9.7
pygit2: 1.9.0
Python: 3.9.2 (default, Feb 28 2021, 17:03:44)
python-gnupg: Not Installed
PyYAML: 5.3.1
PyZMQ: 20.0.0
smmap: 4.0.0
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.3.4

System Versions:
dist: debian 11 bullseye
locale: utf-8
machine: x86_64
release: 5.10.0-15-cloud-amd64
system: Linux
version: Debian GNU/Linux 11 bullseye

Pillar / config used

salt:
  release: '3004'
  py_ver: 'py3'

Bug details

Describe the bug

when executing minion state it's failing:

/home/vveliev# salt-call state.sls salt.minion
[INFO    ] Loading fresh modules for state activity
[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 "<template>", line 74, in top-level template code
jinja2.exceptions.UndefinedError: 'dict object' has no attribute 'version'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/salt/utils/templates.py", line 261, in render_tmpl
    output = render_str(tmplstr, context, tmplpath)
  File "/usr/lib/python3/dist-packages/salt/utils/templates.py", line 509, in render_jinja_tmpl
    raise SaltRenderError("Jinja variable {}{}".format(exc, out), buf=tmplstr)
salt.exceptions.SaltRenderError: Jinja variable 'dict object' has no attribute 'version'
[CRITICAL] Rendering SLS 'feat/salt-test:salt.minion' failed: Jinja variable 'dict object' has no attribute 'version'

Steps to reproduce the bug

run salt-call state.sls salt.minion without setting version

Expected behaviour

expecting for miniuon to be configured just as state.sls salt.master

Attempts to fix the bug

Additional context

after checking sls files, it looks like master and minion do have different code for figuring out version where master actually checks if version is defined or not before attempting to use it