salt: Release notes for v3000 do not mention changes to `slspath` variable
Description of Issue
Release notes for v3000 do not mention changes to slspath
variable by #55434 / #55433 , which previously returned the parent directory instead of the path to the state file itself.
This functionality appears to be covered by the tpldir
variable, but this is not documented on https://docs.saltstack.com/en/latest/ref/states/vars.html.
Can both the v3000 release notes and the SLS Template Variable Reference be updated to make this more visible to others?
Setup
Tree:
/srv/salt/users/
|-- files
| |-- bash_profile
| |-- bashrc
| |-- login.defs
| |-- root_profile
| `-- vimrc
|-- init.sls
|-- root.sls
`-- staff.sls
root.sls
/root/.bashrc:
file.managed:
- source: salt://{{ slspath }}/files/bashrc
- template: jinja
- defaults:
sls: {{ sls }}
Steps to Reproduce Issue
- Apply users.root state
Output:
----------
ID: /root/.bashrc
Function: file.managed
Result: False
Comment: Source file salt://users/root/files/bashrc not found in saltenv 'base'
Started: 20:46:08.752499
Duration: 2.315 ms
Changes:
----------
Replacing slspath
with tpldir
resolves the issue, but this is not an obvious fix.
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.8.1
libgit2: Not Installed
M2Crypto: 0.33.0
Mako: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.6.2
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: 2.6.1
pycryptodome: 3.7.3
pygit2: Not Installed
Python: 3.6.8 (default, Aug 7 2019, 17:28:10)
python-gnupg: Not Installed
PyYAML: 3.11
PyZMQ: 15.3.0
smmap: Not Installed
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.1.4
System Versions:
dist: centos 7.7.1908 Core
locale: ANSI_X3.4-1968
machine: x86_64
release: 3.10.0-1062.9.1.el7.x86_64
system: Linux
version: CentOS Linux 7.7.1908 Core
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 10
- Comments: 25 (20 by maintainers)
Commits related to this issue
- feat: supports salt v3000 https://github.com/saltstack/salt/issues/56119 slspath ==> tpldir — committed to clearasmudd/windows-formula by muddman 4 years ago
- feat: supports salt v3000 https://github.com/saltstack/salt/issues/56119 slspath ==> tpldir — committed to clearasmudd/windows-formula by muddman 4 years ago
- Add regression test for #56119 — committed to dwoz/salt by dwoz 4 years ago
For
tpldir
not being documented: #50925@dhs-rec And some people are expecting
slspath
to work as documented. Before,tpldir
andslspath
did the same thing, and that’s clearly not the intent. In addition, it deprives people of a means to get the path of the SLS file.Since this has gone completely undocumented AND is a backwards incompatible change, I’d vote for reverting it to the previous behaviour and only then announce it as being deprecated and change it in the second next release. Nothing else does make any sense.
A quick patch:
patches/slspath.sls:
patches/files/3000-slspath.diff:
Run
sudo salt MINION state.apply patches.slspath
to apply the fix.Another thing I noticed about this change is it made things in-consistent. With the change, running state with the
foo/init.sls
would return still return the directory where theinit.sls
is locatedfoo
. Running a state within a directoryfoo/bat.sls
wougld returnfoo/bat
.When the change is reverted both of the above scenarios return
foo
. Overall, I think the nameslspath
is very misleading and should be addressed. Perhaps by deprecating it all together and makingslsdir
instead. I could also see a case for addingslsdir
and changingslspath
to reflect the actual path (including the file extension).In any case, for the
3000.1
release, I have reverted the change and updated the documentation forslspath
to more accurately reflect the behavior.Yeah, I agree. The correct move here is to build out the documentation, not to break
slspath
again.EDIT: I’ve changed my mind, see below.
I don’t understand how is this going to be resolved. Is the change to
slspath
value going to become permanent (in which case I need to replaceslspath
variable withtpldir
everywhere) or it’s going to be reverted to the previous value (in which case I just need to wait for the next salt release)?The commit: https://github.com/saltstack/salt/commit/5a17dd6390aa8ef9a7f6899e6d9ce8be2b6750f3#diff-96d7010eb773dc57ad2c8eb89cd12807
As all (relevant) unittests reported success, it may be a good idea to harden the variables with unittests.
+1. Sure do love these breaking changes.
Add me a +1. This breaks previously working SLS files and it is frustrating to have this happen with ZERO indication.