Fix up the owner-sync script.
This commit is contained in:
parent
ad5c66fbf7
commit
35cedf8547
1 changed files with 12 additions and 4 deletions
|
@ -144,7 +144,9 @@ def get_pagure_projects(namespace):
|
||||||
while url:
|
while url:
|
||||||
response = requests.get(url, verify=VERIFY).json()
|
response = requests.get(url, verify=VERIFY).json()
|
||||||
for project in response['projects']:
|
for project in response['projects']:
|
||||||
yield project
|
# Skip forks
|
||||||
|
if not project['fullname'].startswith('forks/'):
|
||||||
|
yield project
|
||||||
url = response['pagination']['next']
|
url = response['pagination']['next']
|
||||||
|
|
||||||
|
|
||||||
|
@ -154,11 +156,17 @@ def get_project_ownership(tag, namespace):
|
||||||
# Check if this project has the branch we are interested in
|
# Check if this project has the branch we are interested in
|
||||||
project_branches_url = '{0}api/0/{1}/{2}/git/branches'.format(
|
project_branches_url = '{0}api/0/{1}/{2}/git/branches'.format(
|
||||||
PAGURE_URL, namespace, project['name'])
|
PAGURE_URL, namespace, project['name'])
|
||||||
project_branches_rv = \
|
project_branches_rv = requests.get(project_branches_url, verify=VERIFY)
|
||||||
requests.get(project_branches_url, verify=VERIFY).json()
|
|
||||||
|
# If the project's branches can't be reported, let's skip the project
|
||||||
|
# for now.
|
||||||
|
if not project_branches_rv.ok:
|
||||||
|
continue
|
||||||
|
|
||||||
|
project_branches_rv_json = project_branches_rv.json()
|
||||||
|
|
||||||
# The tag and branch names are the same for "old-style" branches
|
# The tag and branch names are the same for "old-style" branches
|
||||||
if tag in project_branches_rv['branches']:
|
if tag in project_branches_rv_json['branches']:
|
||||||
# Although this is a list, Pagure only supports one owner for now
|
# Although this is a list, Pagure only supports one owner for now
|
||||||
projects[project['name']] = project['access_users']['owner'][0]
|
projects[project['name']] = project['access_users']['owner'][0]
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue