salt icon indicating copy to clipboard operation
salt copied to clipboard

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

Open iils-jschmidt opened this issue 8 months ago • 0 comments

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

iils-jschmidt avatar Jun 18 '24 15:06 iils-jschmidt