mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Simplify by using to_unicode helper
This commit is contained in:
parent
5a0cda51ed
commit
b533fa179a
1 changed files with 5 additions and 2 deletions
|
@ -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)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue