saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Get access to the Salt software package repository here:
https://repo.saltproject.io/
Apache License 2.0
13.98k stars 5.47k forks source link

Salt displays an unhelpful error message when a sls file has no state #66648

Open iils-jschmidt opened 1 week ago

iils-jschmidt commented 1 week ago

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