-
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
Read Pillar files into OrderedDict to preserve source order #17284
Conversation
Test Failed. If the failures are unrelated to your code, don't stress, a core developer will know these apart. |
Thanks @benosman ! Welcome to the project! |
Re-triggering tests to get test data. |
Test Failed. If the failures are unrelated to your code, don't stress, a core developer will know these apart. |
Thanks for looking at this @thatch45 & @rallytime. I'm sure you're way ahead of me here, but I took a look at the test results myself and can see at least two that are obviously caused by this patch: integration.client.kwarg.StdTest.test_kwarg_type You may have worked this out for yourselves already, but I wanted to explain my thinking: This patch does two things, one is make the Pillar class use OrderedDict which is quite a simple and unobtrusive fix. This works fine when using salt-call in local mode. The change in payload.py, instead is a bit more invasive and was the harder one for me to locate (as a noob!). Even though the Pillar was an OrderedDict it got broadcasted to the minion as a dict. The patch makes it unpack the msgpack payload into OrdereredDicts. So even if it was a regular dict on the master it now becomes an OrderedDict. If that is not desirable behaviour, the way around that would be to pack them differently so an OrderedDict on the master is an OrderedDict on the minion, and a dict on the master is a dict on the minion. |
@benosman I am sorry I have not been able to look more closely into this one yet, it has been a very crazy week and I have been sick with the flu. |
@thatch45 - sorry to hear you have been suffering with the flu - hope you are starting to feel better now! I've rebased the patch against develop now for you to take a look. I agree that having different behaviour when msgpack is an older version is not desirable. I need to look into msgpack deeper before I can suggest a workaround for this. Are there any statistics available anywhere to find out what the installed base of msgpack < 0.2.0 is ? |
Test Failed. If the failures are unrelated to your code, don't stress, a core developer will know these apart. |
Read Pillar files into OrderedDict to preserve source order
Looks good! Thanks @benosman ! |
@benosman This PR had to be reverted because it was causing some unusual test failures on our test suite. Since the original test data has disappeared from Jenkins on your pull request, I'll list the failures here, in case you'd like to revisit this in the future:
Feel free to let me know if you have questions about running the test suite or anything like that. |
@rallytime - ok understood. I was actually a bit surprised that this got merged so soon - as i thought there were still issues to discuss with it, including the tests. I'll get myself set up with the test suite, but it may take me a couple of days to be able to look into this. |
No problem! I'm happy to answer any questions about the tests. Also, there's some helpful docs about running the test suite here: http://docs.saltstack.com/en/latest/topics/development/tests/ Thanks for contributing! |
@rallytime is this still an ongoing issue, because I have recently came across an issue which is similar. |
@aboe76 I am not sure what the status of this is actually. The pull request was originally made against develop in November, but then was subsequently reverted a day or two later because of some unusual test failures as noted above. I am not sure if @benosman made another attempt at this or not. What were the issues you were seeing @aboe76 that might be related? (Perhaps it would be better to address those in the issue this pull request was attempting to fix, as those get more visibility that closed PRs usually...depends on what your issue is I suppose.) |
@rallytime thanks will fill the issue with more up to date information. thanks. |
Sorry, but i've been unable to find the time to work on this recently, and i've found a workaround for my own requirements for now. Would be keen to see it added in some form, but i think the msgpack version issue may need some discussion. |
This pull request attempts to solve Enhancement #12161.
I'm very new to Salt, but It's something i'd like for my own states so I thought working on a patch was a good way to get familiar with the internals of SaltStack.
I've tested the functionality in both master-minion and masterless setup and it keeps the pillars in an OrdererdDict.
It does not attempt to change the 'master' values, as I don't see the need and that would mean touching the code in many places.