From b05d304d0d1927c026ad5080049b62fdcf5e202d Mon Sep 17 00:00:00 2001 From: Gerrod Ubben Date: Mon, 7 Oct 2024 10:44:32 -0400 Subject: [PATCH] Fix some 500 errors in the galaxy api (cherry picked from commit d3cda1917ece7583112b3304217f112b35a9c353) --- CHANGES/galaxy500s.bugfix | 1 + pulp_ansible/app/galaxy/v3/views.py | 2 +- pulp_ansible/app/settings.py | 10 +++++----- 3 files changed, 7 insertions(+), 6 deletions(-) create mode 100644 CHANGES/galaxy500s.bugfix diff --git a/CHANGES/galaxy500s.bugfix b/CHANGES/galaxy500s.bugfix new file mode 100644 index 000000000..dcb9f43e8 --- /dev/null +++ b/CHANGES/galaxy500s.bugfix @@ -0,0 +1 @@ +Fixed some 500 errors when browsing the Galaxy API. diff --git a/pulp_ansible/app/galaxy/v3/views.py b/pulp_ansible/app/galaxy/v3/views.py index caa4c748f..6236d346a 100644 --- a/pulp_ansible/app/galaxy/v3/views.py +++ b/pulp_ansible/app/galaxy/v3/views.py @@ -140,7 +140,7 @@ def _repository_version(self): repo_version = distro.repository.latest_version() if distro.repository else None self.pulp_context = {path: repo_version} - self._repo = distro.repository.ansible_ansiblerepository + self._repo = repo_version.repository.cast() if repo_version else None self._repo_version = repo_version return repo_version diff --git a/pulp_ansible/app/settings.py b/pulp_ansible/app/settings.py index a9bd8a601..65a8d4549 100644 --- a/pulp_ansible/app/settings.py +++ b/pulp_ansible/app/settings.py @@ -20,6 +20,11 @@ "dynaconf_merge": True, } +DRF_ACCESS_POLICY = { + "dynaconf_merge_unique": True, + "reusable_conditions": ["pulp_ansible.app.global_access_conditions"], +} + ANSIBLE_API_HOSTNAME = "https://" + socket.getfqdn() ANSIBLE_CONTENT_HOSTNAME = settings.CONTENT_ORIGIN + "/pulp/content" ANSIBLE_SIGNATURE_REQUIRE_VERIFICATION = True @@ -30,8 +35,3 @@ ANSIBLE_COLLECT_DOWNLOAD_COUNT = False ANSIBLE_AUTHENTICATION_CLASSES = settings.REST_FRAMEWORK["DEFAULT_AUTHENTICATION_CLASSES"] ANSIBLE_PERMISSION_CLASSES = settings.REST_FRAMEWORK["DEFAULT_PERMISSION_CLASSES"] - -DRF_ACCESS_POLICY = { - "dynaconf_merge_unique": True, - "reusable_conditions": ["pulp_ansible.app.global_access_conditions"], -}