-
Notifications
You must be signed in to change notification settings - Fork 282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow merging of acls from multiple pillar files #142
base: master
Are you sure you want to change the base?
Conversation
can you show a run of it doing it? Also maybe it's just me but I dont think of pillars as being mergeable things. I'm asking to play devils advocate, I'm relatively new to salt. Not new enough to not understand it at its core but I haven't used it in enough environments to come across what you're describing. I haven't seen this behavior in other CF tools either like puppet or chef. |
Pinging @blbradley just out of curiosity if this type of pillar behavior is common or a community standard |
94bac9f
to
ecba3d9
Compare
@myoung34 it depends on how you structure your pillar data. In some cases it may make sense to define all the ACLs in one file, but in other cases it may make sense to define them in different pillar files. I personally like to structure things so that everything related to a specific application/system is defined in the same pillar file, and I include that file per host as needed. An example might be the following:
Doing this I can easily install a different set of apps on each host without clobbering the ACLs of other apps. Everytime you include a pillar file in the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really like this stuff.
Although sorting by ACL group
name doesn't look like a perfect solution, it's fine since we have the postgres
local user entry coming first in the pg_hba.conf
template.
I think this PR is good to go.
@vutny if ordering is important then I would suggest using a groups naming scheme where names start with numbers. Something like:
|
Nice! Would you mind to update the |
Im gonna let someone else be the one to merge this. I've not seen this functionality before, and having data get merged in from multiple places is unpredictable. I conversed with another maintainer and we both think that the config should come from one file. I'm going to go with your statements of |
@jerrykan Thank you for your contribution. I am the other maintainer @myoung34 talked to. We both agree that most users would use a single pillar file to configure postgres via Salt. I can see a use case where someone would want to use the postgres pillar key to configure their application's database connection parameters. Your change could help this. However, I believe that use case can be easily covered by using Edit: inserted 'pillar' in second paragraph |
|
@blbradley @myoung34 I understand your concerns. I have numerous hosts with PostgreSQL serving different purposes, i.e. has different roles. Let's say something like This is where having a single large Pillar config for each instance does not scale at all. From time to time I need to update common configuration. And instead of modifying a common Pillar for all minions which is applied via The ability to merge Pillars from different sources really helps a lot and widely used. It enables flexibility and makes maintenance easier. Limiting the formula to support just a basic cases which most users want discourages scalability and prevents application of the formula in complex real-world environments. We already merge Pillar data with I think that the improvement submitted by @jerrykan is awesome and extremely useful. The implementation is small, simple and even backwards-compatible. And I would really appreciate to have it in the upstream. Thank you all. |
@vutny Thanks for the link to pillar namespace flattening. @myoung34 Give that link a read. I think that would be the common pillar behavior you were looking for. Then, look at the new pillar example, and tell me what you think. FYI, (in general) all pillar data gets merged together, and the rules can be a bit strange. I think this change could be good based on the link. @jerrykan Please give us a state run as per @myoung34's request. |
I just noticed that this pull request seems to have been neglected by me. Are these changes still of interest? If so I can rebase them off the current master and try to get them upstream again. What other work would be needed? |
ecba3d9
to
eafbdff
Compare
ba1cb99
to
5090f98
Compare
It would be useful to be able to define acls in multiple different pillar files. This is not possible using a list because lists can not be merged. If we use a dict then salt can merge all the acls together. The key name for the lists is only used for sorting the groupings of acls. For backwards compatibility we check to see if postgres:acls is a list and handle it properly.
5090f98
to
6f8eb6e
Compare
It would be useful to be able to define acls in multiple different pillar files. This is not possible using a list because lists can not be merged. If we use a dict then salt can merge all the acls together. The key name for the lists is only used for sorting the groupings of acls.
For backwards compatibility we check to see if
postgres:acls
is a list and handle it properly.