From 60c250af37e3878307aba5103d3234eaafef9f3c Mon Sep 17 00:00:00 2001 From: Andreas Lutro Date: Mon, 3 Aug 2015 16:56:28 +0200 Subject: [PATCH] file.managed: tmp_filename needs to always be defined --- salt/states/file.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/salt/states/file.py b/salt/states/file.py index a5c1b5bc2a..5a526a1e67 100644 --- a/salt/states/file.py +++ b/salt/states/file.py @@ -1472,6 +1472,8 @@ def managed(name, log.debug(traceback.format_exc()) return _error(ret, 'Unable to manage file: {0}'.format(exc)) + tmp_filename = None + if check_cmd: tmp_filename = salt.utils.mkstemp() @@ -1559,7 +1561,8 @@ def managed(name, log.debug(traceback.format_exc()) return _error(ret, 'Unable to manage file: {0}'.format(exc)) finally: - os.remove(tmp_filename) + if tmp_filename: + os.remove(tmp_filename) def directory(name,