Make sure a str type is passed to os.walk

With strings internally being unicode types in 2018.3.0, we end up
passing a unicode path to os.walk. Python 2 appears to have a bug in the
stdlib in some versions, in which posixpath can't handle unicode types.
This commit ensures that we pass a str type to os.walk in our os.walk
helper.
This commit is contained in:
Erik Johnson 2018-04-18 15:54:07 -05:00
parent b46365614b
commit 9e29acb477
No known key found for this signature in database
GPG key ID: 5E5583C437808F3F

View file

@ -406,5 +406,5 @@ def os_walk(top, *args, **kwargs):
This is a helper than ensures that all paths returned from os.walk are
unicode.
'''
for item in os.walk(top, *args, **kwargs):
for item in os.walk(salt.utils.stringutils.to_str(top), *args, **kwargs):
yield salt.utils.data.decode(item, preserve_tuples=True)