Simplify by using to_unicode helper

This commit is contained in:
Daniel A. Wozniak 2018-08-22 10:01:39 -07:00
parent 5a0cda51ed
commit b533fa179a
No known key found for this signature in database
GPG key ID: 166B9D2C06C82D61

View file

@ -547,8 +547,11 @@ def rm_rf(path):
if os.path.islink(path) or not os.path.isdir(path):
os.remove(path)
else:
if six.PY2 and salt.utils.platform.is_windows() and isinstance(path, six.string_types):
path = path.decode('utf-8')
if salt.utils.platform.is_windows():
try:
path = salt.utils.stringutils.to_unicode(path)
except TypeError:
pass
shutil.rmtree(path, onerror=_onerror)