mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
Make recurse and directory case sensitive
This commit is contained in:
parent
e75fc1c603
commit
64f45f8650
@ -620,6 +620,7 @@ def _check_file(name):
|
||||
def _find_keep_files(root, keep):
|
||||
'''
|
||||
Compile a list of valid keep files (and directories).
|
||||
Used by _clean_dir()
|
||||
'''
|
||||
real_keep = set()
|
||||
real_keep.add(root)
|
||||
@ -3021,7 +3022,7 @@ def directory(name,
|
||||
perms: full_control
|
||||
- win_inheritance: False
|
||||
'''
|
||||
name = os.path.normcase(os.path.expanduser(name))
|
||||
name = os.path.expanduser(name)
|
||||
ret = {'name': name,
|
||||
'changes': {},
|
||||
'pchanges': {},
|
||||
@ -3549,7 +3550,7 @@ def recurse(name,
|
||||
# "env" is not supported; Use "saltenv".
|
||||
kwargs.pop('env')
|
||||
|
||||
name = os.path.normcase(os.path.expanduser(sdecode(name)))
|
||||
name = os.path.expanduser(sdecode(name))
|
||||
|
||||
user = _test_owner(kwargs, user=user)
|
||||
if salt.utils.platform.is_windows():
|
||||
|
@ -1960,15 +1960,20 @@ class TestFindKeepFiles(TestCase):
|
||||
|
||||
@skipIf(not salt.utils.platform.is_windows(), 'Only run on Windows')
|
||||
def test__find_keep_files_win32(self):
|
||||
'''
|
||||
Test _find_keep_files. The `_find_keep_files` function is only called by
|
||||
_clean_dir, so case doesn't matter. Should return all lower case.
|
||||
'''
|
||||
keep = filestate._find_keep_files(
|
||||
'c:\\test\\parent_folder',
|
||||
['C:\\test\\parent_folder\\meh-2.txt']
|
||||
['C:\\test\\parent_folder\\meh-1.txt',
|
||||
'C:\\Test\\Parent_folder\\Meh-2.txt']
|
||||
)
|
||||
expected = [
|
||||
'c:\\',
|
||||
'c:\\test',
|
||||
'c:\\test\\parent_folder',
|
||||
'c:\\test\\parent_folder\\meh-2.txt'
|
||||
]
|
||||
'c:\\test\\parent_folder\\meh-1.txt',
|
||||
'c:\\test\\parent_folder\\meh-2.txt']
|
||||
actual = sorted(list(keep))
|
||||
assert actual == expected, actual
|
||||
self.assertListEqual(actual, expected)
|
||||
|
Loading…
Reference in New Issue
Block a user