file.managed: tmp_filename needs to always be defined

This commit is contained in:
Andreas Lutro 2015-08-03 16:56:28 +02:00
parent 0b10cead06
commit 60c250af37

View File

@ -1472,6 +1472,8 @@ def managed(name,
log.debug(traceback.format_exc()) log.debug(traceback.format_exc())
return _error(ret, 'Unable to manage file: {0}'.format(exc)) return _error(ret, 'Unable to manage file: {0}'.format(exc))
tmp_filename = None
if check_cmd: if check_cmd:
tmp_filename = salt.utils.mkstemp() tmp_filename = salt.utils.mkstemp()
@ -1559,7 +1561,8 @@ def managed(name,
log.debug(traceback.format_exc()) log.debug(traceback.format_exc())
return _error(ret, 'Unable to manage file: {0}'.format(exc)) return _error(ret, 'Unable to manage file: {0}'.format(exc))
finally: finally:
os.remove(tmp_filename) if tmp_filename:
os.remove(tmp_filename)
def directory(name, def directory(name,