Use python-copr to get DNF repo URL

This commit is contained in:
Jakub Kadlčík
2016-10-19 15:15:18 +02:00
parent f28d69dc83
commit 64ae340122
2 changed files with 9 additions and 7 deletions

5
copr.conf Normal file
View File

@@ -0,0 +1,5 @@
[copr-cli]
login =
username =
token =
copr_url = http://copr-fe-dev.cloud.fedoraproject.org

View File

@@ -27,9 +27,8 @@
import modulemd
from pdc_client import PDCClient
from copr.client import CoprClient
import six
import requests
import json
@@ -173,12 +172,10 @@ def get_module_repo(session, module_info, strict=False):
raise NotImplementedError
# Module was built in Copr
base = "http://copr-fe-dev.cloud.fedoraproject.org"
# @TODO get the correct user
data = {"owner": "@copr", "nvr": module["variant_id"]}
r = requests.post("{}/api/module/repo/".format(base), data=data)
response = json.loads(r.content)
owner, nvr = "@copr", module["variant_id"]
cl = CoprClient.create_from_file_config('./copr.conf')
response = cl.get_module_repo(owner, nvr).data
if response["output"] == "notok":
raise ValueError(response["error"])