Merge pull request #35352 from twangboy/file.recurse.clean

Fix file.recurse with clean: True  on Windows (2016.3)
This commit is contained in:
Mike Place 2016-08-11 09:46:11 +09:00 committed by GitHub
commit 72f3548671

View file

@ -416,7 +416,7 @@ def _clean_dir(root, keep, exclude_pat):
while True:
fn_ = os.path.dirname(fn_)
real_keep.add(fn_)
if fn_ in ['/', ''.join([os.path.splitdrive(fn_)[0], '\\'])]:
if fn_ in ['/', ''.join([os.path.splitdrive(fn_)[0], '\\\\'])]:
break
def _delete_not_kept(nfn):
@ -2457,7 +2457,7 @@ def recurse(name,
merge_ret(path, _ret)
return
else:
os.remove(path)
__salt__['file.remove'](path)
_ret['changes'] = {'diff': 'Replaced file with a directory'}
merge_ret(path, _ret)