Skip to content

Commit

Permalink
Fix constraints violation on is_highest in import
Browse files Browse the repository at this point in the history
This field is not correct anyway and it is removed in newer versions. We
only set it to False here hoping it will not be worse but also as the
minimal possible change.

This is a backportable version of the fix.

relates to #1986

[noissue]

(cherry picked from commit 0474b11)
  • Loading branch information
mdellweg committed Oct 29, 2024
1 parent 726cf86 commit b67faf4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES/1986.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Set `is_highest` to `False` before importing a collection version to prevent conflicts.
3 changes: 3 additions & 0 deletions pulp_ansible/app/modelresource.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ def before_import_row(self, row, **kwargs):

col = Collection.objects.get(name=row["name"], namespace=row["namespace"])
row["collection"] = str(col.pk)
# This field easily produces constraints violations.
# But it's neither useful nor correct. It's removed in newer versions anyway.
row["is_highest"] = False

def set_up_queryset(self):
"""
Expand Down

0 comments on commit b67faf4

Please sign in to comment.