saltstack / saltstack/salt

[BUG] salt converts 'false', 'off' to False, 'true', 'on' to True for cmd.run and cmd.run_all

Open
#63,236 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Sorry if this has been fixed already, given the keywords it's difficult to search.

Description

The salt command is being overzealous by converting command names to Python values as described above,

Setup
I think the setup is irrelevant, as this seems to be happening on the command line.

Steps to Reproduce the behavior

[root@singlenode tmp]# salt '*' cmd.run 'false'
6287c6e3-f7d1-46e5-b216-8219e5a938de:
    /bin/sh: False: command not found
ERROR: Minions returned with non-zero exit code
[root@singlenode tmp]# salt '*' cmd.run_all 'on'
6287c6e3-f7d1-46e5-b216-8219e5a938de:
    ----------
    pid:
        762624
    retcode:
        127
    stderr:
        /bin/sh: True: command not found
    stdout:
ERROR: Minions returned with non-zero exit code

Expected behavior
Commands false and on should be run instead of False and True.

Versions Report
salt-3002.2-1.el7.noarch

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 with the Salt command-line handling for cmd.run and cmd.run_all, then reproduce the reported commands using the issue's examples. Trace where the command argument is converted before execution; done means false, off, true, and on are passed as literal command text and the examples no longer invoke False or True.

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
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.