Skip to content

Commit

Permalink
Stop overwriting new refs with old ones when copying them
Browse files Browse the repository at this point in the history
closes pulp#288
  • Loading branch information
lubosmj committed Sep 17, 2023
1 parent 5712c70 commit 22c6952
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES/288.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed the procedure of regenerating summaries by using the relevant refs only.
8 changes: 6 additions & 2 deletions pulp_ostree/app/tasks/importing.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,13 @@ async def run(self):
await self.submit_ref_objects()

latest_version = await self.repository.alatest_version()
refs = await sync_to_async(latest_version.get_content)(OstreeRef.objects)

# consider and copy already uploaded refs to correctly regenerate the summary; skip
# refs there were just added to the repository as new content
refs = await sync_to_async(latest_version.get_content(OstreeRef.objects).exclude)(
name__in=(dc.content.name for dc in self.refs_dcs)
)
async for ref in refs:
# consider already uploaded refs to correctly regenerate the summary
file_path = os.path.join(self.repo_path, "refs", "heads", ref.name)
ref_file = await ref._artifacts.aget()
copy_to_local_storage(ref_file.file, file_path)
Expand Down

0 comments on commit 22c6952

Please sign in to comment.