Skip to content
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

[2018.3] Fix to utils/dicttrim.py to honor max_event_size with nested dictionaries #50382

Conversation

Projects
None yet
4 participants
@garethgreenaway
Copy link
Member

commented Nov 5, 2018

What does this PR do?

Adding _trim_dict_in_dict to utils/dictrim.py to be called from trim_dict when data contains a nested dictionary. This will ensure that values will still be trimmed correctly.

What issues does this PR fix or reference?

#50062

Previous Behavior

Event data that contained nested dictionaries that exceeded the max_event_size would not be trimmed because the size of the key was reported, not the actual data inside the dictionary.

New Behavior

If a nested dictionary is found in the event data dictionary, the _trim_dict_in_dict is called recursively, ensuring all values are trimmed correctly.

Tests written?

Not yet.

Commits signed with GPG?

Yes

Please review Salt's Contributing Guide for best practices.

See GitHub's page on GPG signing for more information about signing commits with GPG.

Adding _trim_dict_in_dict to utils/dictrim.py to be called from trim_…
…dict when data contains a nested dictionary. This will ensure that values will still be trimmed correctly.

@garethgreenaway garethgreenaway requested review from cachedout and whytewolf Nov 5, 2018

@whytewolf
Copy link
Contributor

left a comment

This change works well. I noticed no reduction in performance.

And enough of the data is saved that it doesn't compromise the return results.

@garethgreenaway

This comment has been minimized.

Copy link
Member Author

commented Nov 5, 2018

@whytewolf Thanks! I want to include a simple test just to make everything works as expected.

garethgreenaway added some commits Nov 5, 2018

@rallytime rallytime merged commit ed4fa87 into saltstack:2018.3 Nov 5, 2018

7 of 10 checks passed

continuous-integration/jenkins/pr-merge This commit cannot be built
Details
jenkins/pr/py2-windows-2016 The py2-windows-2016 job has failed
Details
jenkins/pr/py3-windows-2016 running py3-windows-2016...
Details
WIP Ready for review
Details
jenkins/pr/docs The docs job has passed
Details
jenkins/pr/lint The lint job has passed
Details
jenkins/pr/py2-centos-7 The py2-centos-7 job has passed
Details
jenkins/pr/py2-ubuntu-1604 The py2-ubuntu-1604 job has passed
Details
jenkins/pr/py3-centos-7 The py3-centos-7 job has passed
Details
jenkins/pr/py3-ubuntu-1604 The py3-ubuntu-1604 job has passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.