[BUG] State.apply list of state run despite state disable
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 5.6k
- Avg merge
- 2d 44m
- Merged PRs (30d)
- 80
Description
Description
When you disable states with state.disable, you cannot run the state individually. But when you give a comma separated list of disable state they are launch despite they are disabled.
Setup
- on-prem machine
- VM (Virtualbox, KVM, etc. please specify)
- VM running on a cloud service, please be explicit and add details
- container LXC (Kubernetes, Docker, containerd, etc. please specify)
- or a combination, please be explicit
- jails if it is FreeBSD
- [] classic packaging
- onedir packaging
- used bootstrap to install
Steps to Reproduce the behavior
- Disable at least 2 state :
state.disable sls1,sls2 - launch
state.apply sls1,sls2
Like this the 2 disabled state will execute
Expected behavior
We expected the same behavior than when you give an explicit list on command line
salt-call state.apply "[sls1,sls2]" ~
local:
Data failed to compile:
----------
The state file "sls1" is currently disabled, to re-enable, run state.enable sls1.
----------
The state file "sls2" is currently disabled, to re-enable, run state.enable sls2.
Versions Report
Salt Version:
Salt: 3004.1
Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: 2.5.3
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 2.9.4
libgit2: Not Installed
M2Crypto: Not Installed
Mako: Not Installed
msgpack: 0.6.2
msgpack-pure: Not Installed
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: Not Installed
pycryptodome: 3.6.1
pygit2: Not Installed
Python: 3.5.3 (default, Apr 5 2021, 09:00:41)
python-gnupg: Not Installed
PyYAML: 3.12
PyZMQ: 17.1.2
smmap: Not Installed
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.2.1
System Versions:
dist: debian 9 stretch
locale: UTF-8
machine: x86_64
release: 5.11.22-5-pve
system: Linux
version: Debian GNU/Linux 9 stretch
Additional context
After code check, i think the problem can be on the module state on function sls : https://github.com/saltstack/salt/blob/a1a07d1c8c07d5df9ff30c74ba5d75530f019a86/salt/modules/state.py#L1159
the type of mods is check for disabled on line 1292
https://github.com/saltstack/salt/blob/a1a07d1c8c07d5df9ff30c74ba5d75530f019a86/salt/modules/state.py#L1292-L1295
but the conversion of mods from string to list appears on line 1390
https://github.com/saltstack/salt/blob/a1a07d1c8c07d5df9ff30c74ba5d75530f019a86/salt/modules/state.py#L1390
Maybe the conversion of mods need to be made earlier.
This is all that i can do with my knowledge of code, i am not capable of made PR and edit code i can only made some analyse like this, hope that it can help.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in salt/modules/state.py, especially the sls function around the disabled-state check near lines 1292-1295 and the mods string-to-list conversion near line 1390. Reproduce the issue with state.disable sls1,sls2 followed by state.apply sls1,sls2, then compare it with the explicit list behavior. Done means comma-separated disabled states are rejected instead of executed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, infrastructure
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100