file.recurse doesn't support multiple sources like file.managed does
I expect file.recurse to behave the same as file.managed when providing a source. Meaning that you could provide a list of sources and it would use the first one that exists. However, file.recurse doesn't do this; it only takes one source value.
I'd like to do something like this:
/etc/skel:
file.recurse:
- user: root
- group: root
- source:
- salt://packages/core/files/skel.{{ grains['host'] }}
- salt://packages/core/files/skel.{{ grains['server_role'] }}
- salt://packages/core/files/skel
Thus having different files and subdirectories for /etc/skel/ for different hosts. Currently it doesn't work this way and I don't know of any alternate way to do it.
Thanks for the request! This is doable, we just need to add the same multi-source logic to file.recurse that's currently in file.managed.
I join this request!
+1!
+1
+1
+1
Actually it already does exactly this, at least in 2015.5. I came here (@yermulnik, you did too?) because I would actually really like for file.recurse to take all sources when I so desire (which I obviously do in this case).
Would something like all_sources=False be a nice option for this?
@The-Loeki, on my side (salt 2015.5.2 (Lithium)) the problem is exactly as described by topicstarter.
@yermulnik héhéhé that's entirely possible in retrospect; looking at the commit history of /salt/states/file.py it seems to be backported real recently (May; ac29c0cdd077a8bcfcb763b4c830d8ebf0e123f4 (?) )
But it hasn't been committed into a release yet?
not sure; that particular commit ought to be in 2015.5.2, all I can tell you is that seems to be working here under 2015.5 git under CentOS 7.1
Awesome, thanks for tracking down that commit, @The-Loeki! It appears to be in 2015.5.2 and will be in 2015.8.0 as well when it's released.
Gah, I didn't read closely enough. The commit does appear to be in 2015.5.2, if I'm reading the github summary correctly. It is definitely in 2015.8.0 release candidates.