From ae02ce10c4dbc392d86afb207135038dc557be49 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jul 23 2020 10:14:00 +0000 Subject: [PATCH 1/2] Encode the project name before querying PDC for it Turns out with python3 we need to encode the project name as otherwise PDC is not able to give us back the appropriate data. Fixes https://pagure.io/releng/issue/9615 Signed-off-by: Pierre-Yves Chibon --- diff --git a/dist_git_auth.py b/dist_git_auth.py index d28bdd5..04678fd 100644 --- a/dist_git_auth.py +++ b/dist_git_auth.py @@ -16,6 +16,7 @@ from __future__ import print_function import logging import re import os +import urllib.parse import requests @@ -94,8 +95,9 @@ class DistGitAuth(GitAuthHelper): "modules": "module", "container": "container", } + name = urllib.parse.quote(project.name) resp = requests.get( - f"{self.pdc_url}component-branches/?global_component={project.name}" + f"{self.pdc_url}component-branches/?global_component={name}" f"&name={refname}&type={namespace2pdctype[project.namespace]}&fields=active" ) From a6c8f7caa8aa85ba6f9e174ad8b37472a1799028 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Jul 23 2020 10:14:08 +0000 Subject: [PATCH 2/2] Change the logger name to be "pagure_auth" This logger is documented in pagure 5.11 where it will be used for more code (auth related). It makes sense for the pagure_dist_git auth module to leverage that logger instead of creating its own. Signed-off-by: Pierre-Yves Chibon --- diff --git a/dist_git_auth.py b/dist_git_auth.py index 04678fd..6dd4a68 100644 --- a/dist_git_auth.py +++ b/dist_git_auth.py @@ -38,7 +38,7 @@ from pagure.lib.git import is_forced_push from pagure.lib.git_auth import GitAuthHelper, _read_file from pagure.utils import is_repo_committer -_log = logging.getLogger(__name__) +_log = logging.getLogger("pagure_auth") class DistGitAuth(GitAuthHelper):