From fc550740254f3ae55f30e21a11eb06dde0df1d44 Mon Sep 17 00:00:00 2001 From: Roi Date: Thu, 28 Mar 2024 06:28:22 +0200 Subject: [PATCH] Fix: ignore-not-found is not working (#138) * Update artifactorycleanup.py * Update base.py --- artifactory_cleanup/artifactorycleanup.py | 2 +- artifactory_cleanup/rules/base.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/artifactory_cleanup/artifactorycleanup.py b/artifactory_cleanup/artifactorycleanup.py index 38ff142..9a37fb3 100644 --- a/artifactory_cleanup/artifactorycleanup.py +++ b/artifactory_cleanup/artifactorycleanup.py @@ -64,7 +64,7 @@ def cleanup(self, block_ctx_mgr, test_ctx_mgr) -> Iterator[CleanupSummary]: # Delete artifacts for artifact in artifacts_to_remove: with test_ctx_mgr(get_name_for_ci(artifact)): - policy.delete(artifact, destroy=self.destroy) + policy.delete(artifact, destroy=self.destroy, ignore_not_found=self.ignore_not_found) # Show summary print(f"Deleted artifacts count: {len(artifacts_to_remove)}") diff --git a/artifactory_cleanup/rules/base.py b/artifactory_cleanup/rules/base.py index 02e2270..36916be 100644 --- a/artifactory_cleanup/rules/base.py +++ b/artifactory_cleanup/rules/base.py @@ -321,5 +321,6 @@ def delete(self, artifact: ArtifactDict, destroy: bool, ignore_not_found: bool = except HTTPError as e: if e.response.status_code == 404 and ignore_not_found: print(f"NOT FOUND - '{artifact_path}' was not found, so not deleted.") + return raise