From 44949b73cf3c05b77bfde2c7e399861a3b7a509e Mon Sep 17 00:00:00 2001 From: Alan Rominger Date: Tue, 24 Nov 2020 15:33:44 -0500 Subject: [PATCH] Avoid copies made from failed updates --- awx/main/tasks.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/awx/main/tasks.py b/awx/main/tasks.py index 2a1c85e23d..82aa6a6de9 100644 --- a/awx/main/tasks.py +++ b/awx/main/tasks.py @@ -2417,9 +2417,10 @@ class RunProjectUpdate(BaseTask): shutil.rmtree(stage_path) # cannot trust content update produced if self.job_private_data_dir: - # copy project folder before resetting to default branch - # because some git-tree-specific resources (like submodules) might matter - self.make_local_copy(instance, self.job_private_data_dir) + if status == 'successful': + # copy project folder before resetting to default branch + # because some git-tree-specific resources (like submodules) might matter + self.make_local_copy(instance, self.job_private_data_dir) if self.original_branch: # for git project syncs, non-default branches can be problems # restore to branch the repo was on before this run