From fba152523cba4bf6b4688da68b9390b001c20e03 Mon Sep 17 00:00:00 2001 From: Thomas S Hatch Date: Tue, 11 Sep 2012 15:57:22 -0600 Subject: [PATCH] Fix #2012 --- salt/utils/__init__.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/salt/utils/__init__.py b/salt/utils/__init__.py index 5dfaf391cf..650ad29200 100644 --- a/salt/utils/__init__.py +++ b/salt/utils/__init__.py @@ -476,7 +476,16 @@ def copyfile(source, dest, backup_mode='', cachedir=''): if backup_mode == 'master' or backup_mode == 'both' and bkroot: # TODO, backup to master pass - shutil.move(tgt, dest) + try: + shutil.move(tgt, dest) + except Exception: + pass + if os.path.isfile(tgt): + # The temp file failed to move + try: + os.remove(tgt) + except Exception: + pass def path_join(*parts):