mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #49361 from rallytime/bp-49244
Back-port #49244 to 2018.3.3
This commit is contained in:
commit
dbcd2fc726
2 changed files with 12 additions and 2 deletions
|
@ -547,6 +547,11 @@ def rm_rf(path):
|
|||
if os.path.islink(path) or not os.path.isdir(path):
|
||||
os.remove(path)
|
||||
else:
|
||||
if salt.utils.platform.is_windows():
|
||||
try:
|
||||
path = salt.utils.stringutils.to_unicode(path)
|
||||
except TypeError:
|
||||
pass
|
||||
shutil.rmtree(path, onerror=_onerror)
|
||||
|
||||
|
||||
|
|
|
@ -62,6 +62,8 @@ log = logging.getLogger(__name__)
|
|||
|
||||
TMP_SOCK_DIR = tempfile.mkdtemp(dir=TMP)
|
||||
TMP_REPO_DIR = os.path.join(TMP, 'gitfs_root')
|
||||
if salt.utils.platform.is_windows():
|
||||
TMP_REPO_DIR = TMP_REPO_DIR.replace('\\', '/')
|
||||
INTEGRATION_BASE_FILES = os.path.join(FILES, 'file', 'base')
|
||||
UNICODE_FILENAME = 'питон.txt'
|
||||
UNICODE_DIRNAME = UNICODE_ENVNAME = 'соль'
|
||||
|
@ -422,6 +424,9 @@ class GitFSTestBase(object):
|
|||
|
||||
# Add a tag
|
||||
repo.create_tag(TAG_NAME, 'HEAD')
|
||||
# Older GitPython versions do not have a close method.
|
||||
if hasattr(repo, 'close'):
|
||||
repo.close()
|
||||
finally:
|
||||
if orig_username is not None:
|
||||
os.environ[username_key] = orig_username
|
||||
|
@ -436,7 +441,7 @@ class GitFSTestBase(object):
|
|||
'''
|
||||
for path in (cls.tmp_cachedir, cls.tmp_sock_dir, TMP_REPO_DIR):
|
||||
try:
|
||||
shutil.rmtree(path, onerror=_rmtree_error)
|
||||
salt.utils.files.rm_rf(path)
|
||||
except OSError as exc:
|
||||
if exc.errno != errno.EEXIST:
|
||||
raise
|
||||
|
@ -457,7 +462,7 @@ class GitFSTestBase(object):
|
|||
_clear_instance_map()
|
||||
for subdir in ('gitfs', 'file_lists'):
|
||||
try:
|
||||
shutil.rmtree(os.path.join(self.tmp_cachedir, subdir))
|
||||
salt.utils.files.rm_rf(os.path.join(self.tmp_cachedir, subdir))
|
||||
except OSError as exc:
|
||||
if exc.errno != errno.ENOENT:
|
||||
raise
|
||||
|
|
Loading…
Add table
Reference in a new issue