| |
@@ -17,10 +17,7 @@
|
| |
import re
|
| |
import os
|
| |
|
| |
- try:
|
| |
- from pdc_client import PDCClient
|
| |
- except ImportError:
|
| |
- PDCClient = None
|
| |
+ import requests
|
| |
|
| |
|
| |
if "PAGURE_CONFIG" not in os.environ and os.path.exists(
|
| |
@@ -76,11 +73,7 @@
|
| |
"ACL_PROTECTED_NAMESPACES", ["rpms"]
|
| |
)
|
| |
|
| |
- pdc_url = pagure_config.get("PDC_URL")
|
| |
- if pdc_url and PDCClient:
|
| |
- self.pdcclient = PDCClient(pdc_url, develop=True)
|
| |
- else:
|
| |
- self.pdcclient = None
|
| |
+ self.pdc_url = pagure_config.get("PDC_URL")
|
| |
|
| |
def is_supported_branch(self, project, refname):
|
| |
""" Returns whether a specific branch is currently supported for Fedora
|
| |
@@ -88,7 +81,7 @@
|
| |
This retrieves the information about EOL status from PDC, to prevent
|
| |
EOL branches being pushed to.
|
| |
"""
|
| |
- if not self.pdcclient:
|
| |
+ if not self.pdc_url:
|
| |
# No way to confirm this is a supported branch, not supported
|
| |
return None
|
| |
if not refname.startswith("refs/heads/"):
|
| |
@@ -101,15 +94,15 @@
|
| |
"modules": "module",
|
| |
"container": "container",
|
| |
}
|
| |
- res = list(
|
| |
- self.pdcclient.get_paged(
|
| |
- self.pdcclient["component-branches"],
|
| |
- global_component=project.name,
|
| |
- type=namespace2pdctype[project.namespace],
|
| |
- name=refname,
|
| |
- fields=["active"],
|
| |
- )
|
| |
+ resp = requests.get(
|
| |
+ f"{self.pdc_url}component-branches/?global_component={project.name}"
|
| |
+ f"&name={refname}&type={namespace2pdctype[project.namespace]}&fields=active"
|
| |
)
|
| |
+
|
| |
+ res = []
|
| |
+ if resp.ok:
|
| |
+ res = resp.json().get("results")
|
| |
+
|
| |
if len(res) == 0:
|
| |
# No status
|
| |
return None
|
| |
We don't make a big use of pdcclient so let's replace it
with a requests.get call.
This commit does not manage the pagination but since the
code raise a ValueError is the request response contains
more than 1 result we should not need to manage the pagination.
Signed-off-by: Clement Verna cverna@tutanota.com