saltstack / saltstack/salt

salt-call with --retcode-passthrough returns exit code 2 if sls is empty

Open
#39,172 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Confirmed Core severity-low
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description of Issue/Question

If I create an empty sls file (or it is rendered to an empty sls file), then using salt-call with --retcode-passthrough will return an exit code of 2. This is essentially a noop, so I'm not sure why that would be considered an error.

Setup
# cat /srv/salt/states/base/test.sls
{# empty state #}
Steps to Reproduce Issue
# salt-call --local --retcode-passthrough state.sls test
local:

Summary for local
-----------
Succeeded: 0
Failed:   0
-----------
Total states run:    0
Total run time:  0.000 ms
# echo $?
2
Versions Report
# salt-call --versions-report
Salt Version:
           Salt: 2016.11.2

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 2.6.0
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.8.1
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.6
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
         pygit2: Not Installed
         Python: 2.6.6 (r266:84292, Aug 18 2016, 15:13:37)
   python-gnupg: Not Installed
         PyYAML: 3.10
          PyZMQ: 14.5.0
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.5

System Versions:
           dist: centos 6.8 Final
        machine: x86_64
        release: 2.6.32-642.13.1.el6.x86_64
         system: Linux
        version: CentOS 6.8 Final

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the empty test.sls case with salt-call --local state.sls test and --retcode-passthrough, then trace how the state.sls result is converted into the command exit code. Done means an empty or rendered-empty SLS is treated as a no-op and does not return exit code 2.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.