Salt displays an unhelpful error message when a sls file has no state
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 5.6k
- Avg merge
- 2d 44m
- Merged PRs (30d)
- 80
Description
Assume there is a sls file that runs some jinja2 in some cases this leads to no state being run.
For example:
{%- if check something %}
some-state-name:
some.state:
...
{%- endif %}
If the condition does not apply no state is there (the actual checks are more involved).
Salt outputs in that case
Success: 0
Failure: 0
All correct, but it also outputs:
ERROR: Minions returned with non-zero exit code
Running with -l debug leads to this:
[DEBUG ] return event: {'hostname123': {'ret': {}, 'out': 'highstate', 'retcode': 2, 'jid': 'somejid'}}
Both messages are not helpful, either omit the error message or tell that "no states have been executed" or something like that.
Versions Report
Salt Version:
Salt: 3006.8
Python Version:
Python: 3.10.14 (main, Apr 3 2024, 21:30:09) [GCC 11.2.0]
Dependency Versions:
cffi: 1.14.6
cherrypy: unknown
dateutil: 2.8.1
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 3.1.3
libgit2: Not Installed
looseversion: 1.0.2
M2Crypto: Not Installed
Mako: Not Installed
msgpack: 1.0.2
msgpack-pure: Not Installed
mysql-python: Not Installed
packaging: 22.0
pycparser: 2.21
pycrypto: Not Installed
pycryptodome: 3.19.1
pygit2: Not Installed
python-gnupg: 0.4.8
PyYAML: 6.0.1
PyZMQ: 23.2.0
relenv: 0.16.0
smmap: Not Installed
timelib: 0.2.4
Tornado: 4.5.3
ZMQ: 4.3.4
System Versions:
dist: debian 11 bullseye
locale: utf-8
machine: x86_64
release: 5.10.0-29-amd64
system: Linux
version: Debian GNU/Linux 11 bullseye
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the case with a conditional SLS file that renders without states, then trace how the empty result and retcode are turned into the CLI output. Done means the zero-state case no longer reports a misleading non-zero error, or clearly explains that no states were executed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- infrastructure
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100