-
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
Drop support for Python 2 unicode string literals in YAML renderer #48309
Conversation
My new integration test doesn't take into account dict iteration order differences. Derp. Fixing this as well as a lint violation, and there appear to be some other related failures. |
e72f90b
to
74e4dbb
Compare
OK, the necessary tests have been updated. I also have deprecated the |
0786332
to
5a46e3c
Compare
The tojson filter makes this obsolete
The tojson filter makes this obsolete
The hacks that these tested are no longer in place
These should be replaced with "tojson".
Since the YAML renderer no longer supports this, we can't use it to load structures with unicode literal strings within them.
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.
@terminalmage thanks 😉
I backported just the This PR should be good to merge pending test results. |
@terminalmage This is failing one test: https://jenkins.saltstack.com/job/PR/job/salt-pr-linode-cent7-py3/6075/ |
@rallytime that should be fixed now. Apparently the jinja |
Backport tojson filter from #48309 to 2018.3
In earlier releases, the below was considered valid usage in Python 2, assuming that
data
was a dictionary containing keys/values which areunicode
types:Jinja will render the unicode string types in Python 2 with the "u" prefix (e.g.
{u'foo': u'bar'}
. While not valid YAML, earlier releases would successfully load these values.This pull request drops this support, effective in the upcoming Fluorine release. Instead, it will now be necessary to use Jinja's "tojson" filter.
The "tojson" filter was added to Jinja in version 2.9, but several LTS releases (RHEL 7, Ubuntu 14.04, etc.) ship with earlier versions in their repositories. Therefore, this PR also adds an implementation of this filter, which will be used if Jinja doesn't already provide it (when it does, the upstream version of the filter will be used).
These changes allow Salt's custom YAML SafeLoader to use the libyaml versions of PyYAML's SafeLoader and SafeDumper (i.e.
yaml.CSafeLoader
andyaml.CSafeDumper
) if PyYAML was built with libyaml support.Thanks to @jacksontj for working with me on this.