From da8b328f80c2ddaae5b132200191622b92fc52bc Mon Sep 17 00:00:00 2001 From: wangruidong <940853815@qq.com> Date: Wed, 3 Jul 2024 17:13:32 +0800 Subject: [PATCH] fix: bulk delete playbook 500 error --- apps/ops/api/playbook.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/ops/api/playbook.py b/apps/ops/api/playbook.py index 92290720f..e75841ff1 100644 --- a/apps/ops/api/playbook.py +++ b/apps/ops/api/playbook.py @@ -40,7 +40,8 @@ class PlaybookViewSet(OrgBulkModelViewSet): instance_id = instance.id super().perform_destroy(instance) dest_path = safe_join(settings.DATA_DIR, "ops", "playbook", instance_id.__str__()) - shutil.rmtree(dest_path) + if os.path.exists(dest_path): + shutil.rmtree(dest_path) def get_queryset(self): queryset = super().get_queryset()