mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 17:33:54 +00:00
tmp file clean up in file.manage - fix for #33708
This commit is contained in:
parent
723699fda9
commit
48c4ee6f31
@ -2112,11 +2112,15 @@ def managed(name,
|
||||
ret.update(cret)
|
||||
if os.path.isfile(tmp_filename):
|
||||
os.remove(tmp_filename)
|
||||
if sfn and os.path.isfile(sfn):
|
||||
os.remove(sfn)
|
||||
return ret
|
||||
# Since we generated a new tempfile and we are not returning here
|
||||
# lets change the original sfn to the new tempfile or else we will
|
||||
# get file not found
|
||||
sfn = tmp_filename
|
||||
if sfn and os.path.isfile(sfn):
|
||||
os.remove(sfn)
|
||||
sfn = tmp_filename
|
||||
else:
|
||||
ret = {'changes': {},
|
||||
'comment': '',
|
||||
@ -2158,6 +2162,8 @@ def managed(name,
|
||||
finally:
|
||||
if tmp_filename and os.path.isfile(tmp_filename):
|
||||
os.remove(tmp_filename)
|
||||
if sfn and os.path.isfile(sfn):
|
||||
os.remove(sfn)
|
||||
|
||||
|
||||
_RECURSE_TYPES = ['user', 'group', 'mode', 'ignore_files', 'ignore_dirs']
|
||||
|
Loading…
Reference in New Issue
Block a user