saltstack / saltstack/salt

When using pillar.items _errors does not trigger retcode 5 as expected

Open
#54,209 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Confirmed needs-testcase Pillar
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description of Issue

When running pillar.items if a pillar fails to render and is caught in _errors it does not set the retcode to 5 as expected. It does fail and set the correct retcode when running state.apply however.

eg:

vagrant@cs-vagrant-test-ryan-01:~$ sudo salt-call pillar.items --retcode-passthrough
local:
    ----------
    _errors:
        - Rendering SLS 'test.ryan' failed, render error:
          while constructing a mapping
            in "<unicode string>", line 1, column 1:
              roles:
              ^
          found conflicting ID 'pip'
            in "<unicode string>", line 22, column 1:
              pip: {}
  rest_of_pillar:
        - renders_fine
Setup

Setup pillar to read from 2 files

first.sls

foo: bar

second.sls

one: two

one: {}
Steps to Reproduce Issue

Do the above and run salt-call pillar.items --retcode-passthrough you should see second.sls fail due to duplicate keys, then echo $? and you'll see the retcode is 0, not 5 as described by the docs.

Versions Report

Same version on minion & master

vagrant@cs-vagrant-test-ryan-01:~$ sudo salt-call --versions-report
Salt Version:
           Salt: 2019.2.0
 
Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 2.4.2
      docker-py: Not Installed
          gitdb: 0.6.4
      gitpython: 1.0.1
          ioflo: Not Installed
         Jinja2: 2.8
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: 1.0.3
   msgpack-pure: Not Installed
 msgpack-python: 0.4.6
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.12 (default, Nov 12 2018, 14:36:49)
   python-gnupg: 0.3.8
         PyYAML: 3.11
          PyZMQ: 15.2.0
           RAET: Not Installed
          smmap: 0.9.0
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.1.4
 
System Versions:
           dist: Ubuntu 16.04 xenial
         locale: UTF-8
        machine: x86_64
        release: 4.4.0-142-generic
         system: Linux
        version: Ubuntu 16.04 xenial

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

Reproduce the issue with the documented pillar.items command, the two pillar files, and --retcode-passthrough, then inspect the pillar.items execution path and its handling of _errors. Compare it with state.apply and the return-code documentation; done means the failed pillar render produces retcode 5 instead of 0.

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
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.