Skip to content
Snippets Groups Projects
Commit 3ba9bb50 authored by James Ennis's avatar James Ennis
Browse files

cli.py: Defer pruning until all specified refs are removed

parent bfd13098
No related branches found
No related tags found
No related merge requests found
......@@ -1100,13 +1100,19 @@ def artifact_delete(app, artifacts):
if element is not None:
elements = [element]
# Remove specified elements and artifacts
if elements:
elements = app.stream.load_selection(elements, selection=PipelineSelection.NONE)
for element in elements:
cache.remove(cache.get_artifact_fullname(element, element._get_cache_key()))
cache_key = element._get_cache_key()
ref = cache.get_artifact_fullname(element, cache_key)
cache.remove(ref, defer_prune=True)
if artifacts:
for i, ref in enumerate(artifacts, start=1):
cache.remove(ref, defer_prune=False)
for ref in artifacts:
cache.remove(ref, defer_prune=True)
# Now we've removed all the refs, prune the unreachable objects
cache.prune()
##################################################################
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment