Skip to content

Commit

Permalink
Taught prune() to call remove_content() with a Content queryset.
Browse files Browse the repository at this point in the history
fixes #3778
  • Loading branch information
ggainey committed Nov 7, 2024
1 parent 5d81100 commit 34bb2f0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES/3778.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix traceback from prune() call discovered after `pulp/pulpcore#5934` addressed.
4 changes: 3 additions & 1 deletion pulp_rpm/app/tasks/prune.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from pulpcore.plugin.models import ProgressReport
from pulpcore.plugin.constants import TASK_STATES
from pulpcore.plugin.models import (
Content,
GroupProgressReport,
RepositoryContent,
TaskGroup,
Expand Down Expand Up @@ -91,8 +92,9 @@ def prune_repo_packages(repo_pk, keep_days, dry_run):
):
log.debug(f'{p["name"]}-{p["epoch"]}:{p["version"]}-{p["release"]}.{p["arch"]}')
else:
content_q = Content.objects.filter(pk__in=target_ids_q)
with repo.new_version(base_version=None) as new_version:
new_version.remove_content(target_ids_q)
new_version.remove_content(content_q)
data["done"] = to_be_removed

pb = ProgressReport(**data)
Expand Down

0 comments on commit 34bb2f0

Please sign in to comment.