salt: [BUG] 3001.x and 3002.x file.recurse: "keep_symlinks: True" not working correctly
We have the following issue with 2015.8.1 and 2015.8.3 when using file.recurse with keep_symlinks set to True:
A softlink which name is a subset (Like: ^NAME_SOFTLINK* ) of other filenames in the same directory will let salt ignore these files by the next update. If “clean: True” is set too, these files would be also deleted from the slave. We discovered this while syncing some custom compiled linux libraries with the typical libxyz.so.X.0.0 -> libxyz.so.X -> libxyz.so linking.
A simple example:
mkdir test; cd test
touch test1 test2 test3
ln -s test3 test
cat << EOF > test.sls
/tmp/test/:
file.recurse:
- source: salt://test/
- include_empty: True
- clean: True
- keep_symlinks: True
EOF
The output:
----------
ID: /tmp/test/
Function: file.recurse
Result: True
Comment: Recursively updated /tmp/test/
Started: 12:00:59.395207
Duration: 321.6 ms
Changes:
----------
/tmp/test/test:
----------
new:
/tmp/test/test
As you see only the symlink survives. All other matching files are ignored.
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 29 (9 by maintainers)
Commits related to this issue
- Document behavior when fileserver_followsymlinks is False. When `fileserver_followsymlinks` is set to `False`, `keep_symlinks` and `force_symlinks` are not taken in account because symlinks are not e... — committed to StyXman/salt by StyXman 3 years ago
- Document behavior when fileserver_followsymlinks is False. When `fileserver_followsymlinks` is set to `False`, `keep_symlinks` and `force_symlinks` are not taken in account because symlinks are not e... — committed to saltstack/salt by StyXman 3 years ago
I’m having issues with file.recurse: keep_symlinks in 3001.3 / 3002.2 versions:
a) If symlink target is missing on the salt master, the error message is returned, as @dynek said earlier and symlink is not created on the minion Comment: #### /tmp/test/a/none #### Source file salt://tmp-test/files/tmp/test/a/none?saltenv=base not found in saltenv ‘base’
b) If symlink on the salt master has an absolute path target (I’ve created the target on the master, to overcome the issue a) ), the symlink is copied to minion as folder/file instead of keeping it as symlink. Salt master: lrwxrwxrwx 1 root root 14 Dec 9 08:04 file -> /tmp/test/file lrwxrwxrwx 1 root root 17 Dec 9 08:04 folder -> /tmp/test/folder/ Salt minion: -rw-r–r-- 1 root root 0 Dec 9 08:05 file drwxr-xr-x 2 root root 4096 Dec 9 08:05 folder/
If symlink on the salt master has an relative path target, it works as expected. Salt master: lrwxrwxrwx 1 root root 7 Dec 9 08:17 file -> …/file lrwxrwxrwx 1 root root 10 Dec 9 08:17 folder -> …/folder/ Salt minion: lrwxrwxrwx 1 root root 7 Dec 9 08:18 file -> …/file lrwxrwxrwx 1 root root 10 Dec 9 08:18 folder -> …/folder/