saltstack / saltstack/salt

Incorrect error message for render issue

Open
#50,691 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description of Issue/Question

When using '- names' of cmd.run in a state, if there is a trailing colon on the end of a command with nothing defined underneath, Salt errors out that invalid arguments were passed to state.apply rather than throwing a render error, or some other more descriptive error.

I guess it's not technically invalid SLS, but this makes troubleshooting the error really confusing because the state does render when using state.show_sls, but state.apply fails as if I am not running it correctly.

Setup

test.sls

"Test Breakage":
  cmd.run:
    - names:
      - 'echo "something"':
Steps to Reproduce Issue
[root@saltmaster salt]# salt-call state.apply test

Passed invalid arguments: 'NoneType' object is not iterable.

Usage:

    .. versionadded:: 2015.5.0

    This function will call :mod:`state.highstate
    <salt.modules.state.highstate>` or :mod:`state.sls
    <salt.modules.state.sls>` based on the arguments passed to this function.
    It exists as a more intuitive way of applying states.

   ... the rest of the help output
Versions Report

(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)

My minions and master are all using 2018.3.2.

Salt Version:
Salt: 2018.3.2

Dependency Versions:
cffi: 1.6.0
cherrypy: Not Installed
dateutil: 2.7.3
docker-py: 3.5.0
gitdb: Not Installed
gitpython: Not Installed
ioflo: Not Installed
Jinja2: 2.7.2
libgit2: 0.26.3
libnacl: Not Installed
M2Crypto: 0.28.2
Mako: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.5.6
mysql-python: Not Installed
pycparser: 2.14
pycrypto: 2.6.1
pycryptodome: Not Installed
pygit2: 0.26.4
Python: 2.7.5 (default, Sep 12 2018, 05:31:16)
python-gnupg: Not Installed
PyYAML: 3.11
PyZMQ: 15.3.0
RAET: Not Installed
smmap: Not Installed
timelib: Not Installed
Tornado: 4.2.1
ZMQ: 4.1.4

System Versions:
dist: redhat 7.6 Maipo
locale: UTF-8
machine: x86_64
release: 3.10.0-957.el7.x86_64
system: Linux
version: Red Hat Enterprise Linux Server 7.6 Maipo

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 issue with the provided test.sls and compare state.show_sls with state.apply. Trace the rendering and argument-validation path for the cmd.run state; done means the trailing-colon case reports a descriptive render error instead of invalid arguments to state.apply.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devops, infrastructure
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.