saltstack / saltstack/salt

salt-call option --states-dir is being ignored

Open
#56,468 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description of Issue

Option --states-dir of salt-call is ignored, as the result state files is not being located. As far as I can see in code relevant configuration option is getting initialized but not used.

Setup

Directory structure:

[root@troll _salt-call_bug]# tree
.
└── states
    └── test.sls

[root@troll _salt-call_bug]# ls -laR
.:
total 4
drwxr-xr-x  3 root root  43 Mar 28 11:43 .
drwxr-xr-x 10 root root 191 Mar 28 11:42 ..
-rw-r--r--  1 root root   7 Mar 28 11:43 .python-version
drwxr-xr-x  2 root root  22 Mar 28 11:45 states

./states:
total 4
drwxr-xr-x 2 root root 22 Mar 28 11:45 .
drwxr-xr-x 3 root root 43 Mar 28 11:43 ..
-rw-r--r-- 1 root root 51 Mar 28 11:45 test.sls

State file:

aaa:
  test.show_notification:
    - text: works !
Steps to Reproduce Issue

salt-call --local --file-root=states state.apply test is succesful
salt-call --local --states-dir=states state.apply test fails with:

local:
    Data failed to compile:
----------
    No matching sls found for 'test' in env 'base'
Versions Report
Salt Version:
           Salt: 3000
 
Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: Not Installed
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
         Jinja2: 2.11.1
        libgit2: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.6.2
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 3.6.10 (default, Mar 28 2020, 09:48:49)
   python-gnupg: Not Installed
         PyYAML: 3.13
          PyZMQ: 19.0.0
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.5.3
            ZMQ: 4.3.2
 
System Versions:
           dist: centos 8.1.1911 Core
         locale: UTF-8
        machine: x86_64
        release: 4.18.0-147.5.1.el8_1.x86_64
         system: Linux
        version: CentOS Linux 8.1.1911 Core

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 two commands in the issue: compare salt-call --local --file-root=states state.apply test with the failing --states-dir variant. Trace how salt-call initializes and consumes these options, then add coverage showing that --states-dir locates states/test.sls and the command succeeds without --file-root.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.