Force file removal on Windows. Fixes #42295

This commit is contained in:
Johannes Scholz 2017-07-14 15:55:23 +02:00
parent a91a3f81b1
commit 026ccf401a

View file

@ -1040,7 +1040,10 @@ def absent(name):
ret['comment'] = 'File {0} is set for removal'.format(name)
return ret
try:
__salt__['file.remove'](name)
if salt.utils.is_windows():
__salt__['file.remove'](name, force=True)
else:
__salt__['file.remove'](name)
ret['comment'] = 'Removed file {0}'.format(name)
ret['changes']['removed'] = name
return ret