automatically delete project files in entire cluster

This commit is contained in:
AlanCoding
2018-09-19 14:46:17 -04:00
committed by Ryan Petrello
parent 695c7ade86
commit 526ca3ae42
2 changed files with 26 additions and 0 deletions

View File

@@ -466,6 +466,14 @@ class Project(UnifiedJobTemplate, ProjectOptions, ResourceMixin, CustomVirtualEn
models.Q(ProjectUpdate___project=self)
)
def delete(self, *args, **kwargs):
path_to_delete = self.get_project_path(check_if_exists=False)
r = super(Project, self).delete(*args, **kwargs)
if self.scm_type and path_to_delete: # non-manual, concrete path
from awx.main.tasks import delete_project_files
delete_project_files.delay(path_to_delete)
return r
class ProjectUpdate(UnifiedJob, ProjectOptions, JobNotificationMixin, TaskManagerProjectUpdateMixin):
'''