From 9c55d06e950062ec409ac22991c023925d5082b6 Mon Sep 17 00:00:00 2001 From: Matthias Dellweg Date: Mon, 28 Oct 2024 18:08:18 +0100 Subject: [PATCH] Fix constraints violation on is_highest in import 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. Fixes #1986 --- CHANGES/1986.bugfix | 1 + pulp_ansible/app/modelresource.py | 3 +++ 2 files changed, 4 insertions(+) create mode 100644 CHANGES/1986.bugfix diff --git a/CHANGES/1986.bugfix b/CHANGES/1986.bugfix new file mode 100644 index 000000000..a328a78ef --- /dev/null +++ b/CHANGES/1986.bugfix @@ -0,0 +1 @@ +Set `is_highest` to `False` before importing a collection version to prevent conflicts. diff --git a/pulp_ansible/app/modelresource.py b/pulp_ansible/app/modelresource.py index 06fd51319..751692308 100644 --- a/pulp_ansible/app/modelresource.py +++ b/pulp_ansible/app/modelresource.py @@ -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): """