-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Remove recurse_list from pillar_source_merging_strategy and add pilla… #30062
Conversation
…r_merge_list (bool) instead
@@ -17,7 +17,7 @@ | |||
log = logging.getLogger(__name__) | |||
|
|||
|
|||
def update(dest, upd, recursive_update=True, merge_lists=False): | |||
def update(dest, upd, recursive_update=True, merge_lists=True): |
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.
The modification of these default values concerns me a little bit because I'm worried that it might regress other functions that use this one. Is this necessary?
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 agree with @cachedout's comment.
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.
@s0undt3ch Given that commit 4af5b5c added this option and set the default of merge_lists=False, a non-existent option until that commit, setting it to True by default would in essence, revert things back to the original functionality where lists were merged unless otherwise so chosen via a new configuration option of pillar_merge_lists in the master config. Leaving this at False is much more likely to cause regressions imo, than leaving only some changes set back to True or in other words, the behavior prior to commit 4af5b5c.
Sorry if my comment is a bit confusing.
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.
Nope, that clarified it for me and the reasoning is good. Thanks!
@@ -130,38 +130,6 @@ def test_topfile_order(self, Matcher, get_file_client): | |||
pillar = salt.pillar.Pillar(opts, grains, 'mocked-minion', 'base') | |||
self.assertEqual(pillar.compile_pillar()['ssh'], 'foo') | |||
|
|||
@patch('salt.pillar.salt.fileclient.get_file_client', autospec=True) |
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.
Could you explain why these tests are removed? I'd definitely like to keep them around if possible.
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.
Commit 4af5b5c initially added the merge_lists=bool argument which caused the regression noted in #29601. This simply would set it back to True, as if it wasn't present to begin with and instead adds a new master_config opt of pillar_merge_lists (default True). In this way, it fixes the initially regression while still allowing someone to opt to not merge the lists by setting pillar_merge_lists: False in /etc/salt/master
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.
They were dropped because there'd be no pillar_source_merging_strategy of recurse_list as it would no longer be necessary.
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.
merge_lists=True
doesn't seem to be tested here at all, or did I missed something out?
Commit 4af5b5c initially added the merge_lists=bool argument which caused the regression noted in #29601. This simply would set it back to True, as if it wasn't present to begin with and instead adds a new master_config opt of pillar_merge_lists (default True). In this way, it fixes the initially regression while still allowing someone to opt to not merge the lists by setting pillar_merge_lists: False in /etc/salt/master |
Thanks for the reply here. So far, this looks pretty good but I definitely want to bring some additional people in for review on this one. I'm thinking of @ryan-lane, @terminalmage, @basepi and @DmitryKuzmenko as people I'd like to look at this. @thatch45 @jacksontj and @s0undt3ch might also want to weigh in. If you wouldn't mind being a little patient on this one, @seanjnkns, we'll get this in. I just want to make sure we get a variety of opinions here when we're dealing with merge strategies, since they can have far-reaching consequences. |
Does this change the default behavior of the current stable release? If so, can we ensure it keeps whatever the current stable behavior is? |
Absolutely. I'm just glad it's being reviewed and considered. There may be a better solution for this, I just know that the aforementioned commit broke backwards compatibility and although I understand it's merits, ideally users should be able to use any of the merge strategies of their choosing instead of being forced to use the recurse_list. |
@ryan-lane, this would change the default behavior of the stable release by undoing the aforementioned commit and make it an option if you want to merge_lists or not, but in turn fix the regression that that commit created. For those using the recurse_list merge strategy, it would fall back to recurse so short of a note in their master logs, nothing would be broken or have unintended consequences. Just the few people expecting to NOT merge lists would just need to set pillar_merge_lists: False in the master config. |
When did the regression appear? Was it in a stable release, or during a point release in stable? What I'd really like to avoid is:
For anyone that's upgrading across releases it's going to be a nightmare, because you go to upgrade and some things are subtly broken, then you figure out why, change your code, then upgrade again and now things are subtly broken again. |
@ryan-lane commit 4af5b5c was introduced in 2015.8.3 so people upgrading from 2015.8.1 to 2015.8.3, like myself, were subtly broken as noted in #29601. This would essentially revert things back to the way they were with 2015.8.1 while still retaining the benefits of commit 4af5b5c. Several issues that requested the initial recurse_list were #27378, #25954, and #28394; possibly others. They'd still get the same benefit from that commit, just would have to set pillar_merge_lists to False. |
Ouch. That's pretty rough. Yeah, it seems that it should be fixed the way you suggest in the point release. |
@cachedout, the PR looks good for me and @seanjnkns arguments sounds reasonable. |
@seanjnkns btw, there is a lint error: |
Anything further I can do to move this along to ensure it gets in the next release? |
I was involved in the decision to change merge_lists to False by default. It was decided at that point that while merging dicts was an intuitive behavior, merging lists was not. See #27890 and #25358 (comment) I continue to be of the opinion that merging lists is the edge case, not the intuitive default case. However, I misunderstood the original introduction of that feature. I thought it was just adding a Your pillar_merge_lists value does exactly this. However, I think it should be False by default. I've had many more people state that merging lists should not be the default than I've heard for it. |
@seanjnkns Did you see the above comments from @basepi ? We'll want to come to a consensus as much as is possible before we get this merged and the release is coming up quickly. :] |
@cachedout @basepi, if the decision is to make the merging of lists be false by default, then perhaps there's no need for this PR and just have people use the merge strategy of recurse_list which is just an extension of the recurse merge strategy. If we went that route, I think the only thing that would need to be updated is the /etc/salt/master to mention the recurse_list merging strategy, much like is already mentioned in the docs. Otherwise, if we want False as the default, I can submit a new commit that sets the default for pillar_merge_lists to False along with the merge_lists in the defs. I can be persuaded either way, just let me know which is the preferred method. |
The reason this is still a good fix is we want people to be able to use |
Set (pillar_)merge_lists to default to False. Let me know if this satisfies the request and if there's any further changes needed. |
This looks perfect! Thanks again @seanjnkns ! |
Remove recurse_list from pillar_source_merging_strategy and add pilla…
@basepi are there plans to backport this merge into 2015.8 as well? |
@basepi will this also be configured in the minion? some of us run masterless.... |
Ah we should definitely backport this. The change went into 2015.8. |
@aboe76 This should apply to any entity which compiles pillar, I think it should "just work" in masterless. |
Back-port done in #30458 |
|
||
.. versionadded:: 2015.8.0 | ||
|
||
Default: ``True`` |
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.
the default is False
, isn't it?
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.
Correct. @seanjnkns would you consider opening a quick PR to fix that mistake in the docs? 2015.8 would be a good target, since this was backported to 2015.8.
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.
@basepi, I did PRs 30602 and 30609 this morning to address this which has already been merged.
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.
Perfect, thank you!
@seanjnkns why is |
Good catch. I've merged your pull request. |
PR for #29601 that adds a new master configuration option of pillar_merge_lists: bool (default True) to readd backwards compatible of merging lists, while still maintaining the option to overwrite them.