Recurse is including mode when it shouldn't
Unless I am completely mistaken the following block:
/tmp/a:
file.directory:
- user: nobody
- group: nogroup
- mode: 755
- recurse:
- user
- group
Should ensure that /tmp/a is owned by nobody/nogroup and has mode 755, and that the contents of /tmp/a recursively would be owned by nobody/nogroup, however the mode would be left alone.
When I start with this state:
-rw-r--r-- 1 nobody nogroup 0 Dec 4 21:55 /tmp/a/c
-rw-r--r-- 1 nobody nogroup 0 Dec 4 21:55 /tmp/a/b
drwxr-xr-x 2 nobody nogroup 4096 Dec 4 21:55 /tmp/a
I get this output line:
Name: /tmp/a - Function: file.directory - Result: True
And end in this state:
-rwxr-xr-x 1 nobody nogroup 0 Dec 4 21:55 /tmp/a/c
-rwxr-xr-x 1 nobody nogroup 0 Dec 4 21:55 /tmp/a/b
drwxr-xr-x 2 nobody nogroup 4096 Dec 4 21:55 /tmp/a
I expect that the state would not trigger since its acceptable in the first pass. This is causing salt to restart a bunch of our services every time its run since we deliver files inside of a directory managed this way.
What version of salt are you using? This may have been fixed recently....
# dpkg -l | grep salt
ii salt-common 0.17.2-2saucy1 all Shared libraries that salt requires for all packages
ii salt-master 0.17.2-2saucy1 all This package provides a remote manager to administer servers via salt
ii salt-minion 0.17.2-2saucy1 all This package represents the client package for salt
Thanks, we'll look into this. It would also be helpful if you could test on the newly-released 0.17.3 version just to make sure it hasn't been fixed.
This bug still presents in 2014.1.10 version.
test code
/tmp/test:
file:
- directory
- user: www-data
- group: www-data
- file_mode: 400
- recurse:
- user
- group
the directory /tmp/test before test:
[12:46:40] root@integration-dev-1:/tmp/test ls -la
total 8
drwxr-xr-x 2 www-data www-data 4096 Oct 31 12:46 .
drwxrwxrwt 6 root root 4096 Oct 31 12:45 ..
-rwx------ 1 www-data www-data 0 Oct 31 12:36 aaa
the state.sls result:
----------
ID: /tmp/test
Function: file.directory
Result: True
Comment: Directory /tmp/test updated
Changes:
----------
mode:
0400
Summary
------------
Succeeded: 1
Failed: 0
------------
Total: 1
the directory /tmp/test after the test
[12:46:42] root@integration-dev-1:/tmp/test ls -la
total 8
drwxr-xr-x 2 www-data www-data 4096 Oct 31 12:46 .
drwxrwxrwt 6 root root 4096 Oct 31 12:46 ..
-r-------- 1 www-data www-data 0 Oct 31 12:36 aaa
File /tmp/test/aaa changed mode from 0700 to 0400 for no reason.
After reading the source code, I think commit 61e5d32b fixed this problem already and it is already in 2014.7 branch.
I will wait until 2014.7 release and test again.
@liquidgecka @favadi Did you get a chance to check this in 2014.7? I'm going to close this for now, if it turns out it was not fixed, reply back and I can reopen it, if need be.
I confirm that it works correctly in salt 2014.7.