Skip to content

Commit

Permalink
Fix mirrored metadata handling when creating new repo versions
Browse files Browse the repository at this point in the history
closes #8756
https://pulp.plan.io/issues/8756

In particular, this allows us to synchronize repos using mirror=false
option.
  • Loading branch information
quba42 committed Nov 22, 2021
1 parent 88d2f33 commit a3ee158
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES/8756.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed mirrored metadata handling when creating a new repository version.
11 changes: 11 additions & 0 deletions pulp_deb/app/models/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,17 @@ class AptRepository(Repository):
class Meta:
default_related_name = "%(app_label)s_%(model_name)s"

def initialize_new_version(self, new_version):
"""
Remove old metadata from the repo before performing anything else for the new version. This
way, we ensure any syncs will re-add all metadata relevant for the latest sync, but old
metadata (which may no longer be appropriate for the new RepositoryVersion is never
retained.
"""
new_version.remove_content(ReleaseFile.objects.all())
new_version.remove_content(PackageIndex.objects.all())
new_version.remove_content(InstallerFileIndex.objects.all())

def finalize_new_version(self, new_version):
"""
Finalize and validate the new repository version.
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pulpcore>=3.15
pulpcore>=3.17.0.dev
python-debian>=0.1.36

0 comments on commit a3ee158

Please sign in to comment.