From 95091e79856934eeb65c78856a43c963f9f0303c Mon Sep 17 00:00:00 2001 From: Andrew Crosby Date: Wed, 7 Oct 2020 14:45:28 -0400 Subject: [PATCH] Fix galaxy collection endpoint results for empty repos https://pulp.plan.io/issues/7669 closes #7669 --- CHANGES/7669.bugfix | 1 + pulp_ansible/app/galaxy/v3/views.py | 3 +++ 2 files changed, 4 insertions(+) create mode 100644 CHANGES/7669.bugfix diff --git a/CHANGES/7669.bugfix b/CHANGES/7669.bugfix new file mode 100644 index 000000000..6789953bc --- /dev/null +++ b/CHANGES/7669.bugfix @@ -0,0 +1 @@ +Fix galaxy collection endpoint results for empty repos diff --git a/pulp_ansible/app/galaxy/v3/views.py b/pulp_ansible/app/galaxy/v3/views.py index 801356b7d..5c712f4c6 100644 --- a/pulp_ansible/app/galaxy/v3/views.py +++ b/pulp_ansible/app/galaxy/v3/views.py @@ -125,6 +125,9 @@ def get_queryset(self): if not value or semantic_version.Version(version) > semantic_version.Version(value): collection_versions[str(collection_id)] = version + if not collection_versions.items(): + return CollectionVersion.objects.none() + query_params = Q() for collection_id, version in collection_versions.items(): query_params |= Q(collection_id=collection_id, version=version)