Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
salt.utils.yamldumper.dump/safe_dump incorrectly return 'str' instead of unicode on python2.7 (centos) #49100
Description of Issue/Question
After upgrading to 2018.3.2 (from 2017.7.2), I've found that when using pillar data (with non-ascii characters) while rendering yaml sls files, it fails with: UnicodeDecodeError: 'ascii' codec can't decode byte...
AFAIK it is due to PyYAML, as invoked at salt/utils/yamldumper.py:safe_dump, returning an 'str' object, which later on is being coerced into unicode as if it where an ascii-based string.
IMHO, this can be fixed by invoking salt.utils.stringutils.to_unicode() to yaml data before returning. I'll try to submit a pull-req next.
First you will need some misc data at pillar (in my case git-based ext_pillar), like:
Then a sample state like this one:
Steps to Reproduce Issue