Feature request: `extend` functionality in pillar .sls
Currently defining defining pillar key the second time will overwrite the contents of the first definition, i.e.:
first.sls:
data:
love
second.sls:
data:
hate
top.sls:
base:
"*":
- first
- second
The result pillar:
data:
hate
Proposition A
As the pillar definitions are pure data, there is no need to have unique IDs, or unique keys at all.
- If there are overlapping keys defined, merge their contents by default:
first.sls:
data:
love
second.sls:
data:
hate
resulting pillar:
data:
love
hate
- Have keyword reserved to override default behavior and have second definition replace the first one
- Have keyword reserved to have a second definition exclude data from the first one
Proposition B
Pillar is data, data is a set. Implement basic set operations: union, intersection, difference for overlapping data definitions.
This can get very complicated because pillar data is not structured like state data, but it should be a viable thing to add, I have set this to 0.15.0, but it might get bumped if it proves too complicated
+1*10^3 :-)
Default should be simple, and the current behavior -- overwrite -- is fine for the default. At least you can control it with the order of include's. Union will change arity of the data, which becomes problematic for nested structures.
Let's define a uniform convention and have tests which will demonstrate each case. Then the tests can serve as the docs on include/extend behaviors.
ran into this today, wanted to extend a network setting pillar with another one derived from the first and was puzzled why the data was missing. +1 from me!
+1 Please make some way of mixing data structures. Otherwise it is impossible to manage complicated structures such as access lists without lots of CUT & PASTE.
Another +1 here. I tend to use the top level pillar object name for scoping the pillar data and would like to be able to extend the object with more data from another pillar file.
pillar of pillars :-)
+1 from me, avoids tedious copying/maintenance of long lists (e.g. users) with only some different entries.
+1. Forcing us to have unique IDs is making our state configuration messy and difficult to maintain.
Yes, I am sorry we keep pushing this off, we will get it in!
This seems to be a duplicate of an older issue I posted #2466. But I am still really looking forward to this being added in 17.0!
I posted a proposal about include/extend issues on #2466. Eventually we can use the same logic for top files ?
+1 forced to use unique id's is giving me a long complicated pillar dict for a server. and the state configuration now needs to look for different keys, where it could just loop through one if pillar dicts were extensible.
+1 If pillars could have "defaults" then my life would be easier.
+1
why don't use Jinja {%- include 'common.sls' -%} ?
redbaron you can include without jinja. It will still not merge namespaces.
+1 for Pillar files with some form of shared/extended namespaces.
+1
To reiterate what I mentioned in the referenced issue above, what I'm looking to do by extending and replacing Pillar data is this: https://gist.github.com/garethgreenaway/7237050
I want common data available to all hosts but have the ability to overwrite those values on a host by host basis.