From 9bf76aff09b61cb59b23288b4a59136b254919d2 Mon Sep 17 00:00:00 2001 From: Ralph Bean Date: Mon, 7 Aug 2017 17:07:18 +0000 Subject: [PATCH] Have the koji owner sync job paginate through pagure projects. --- .../backend/templates/owner-sync-pagure.j2 | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/roles/bodhi2/backend/templates/owner-sync-pagure.j2 b/roles/bodhi2/backend/templates/owner-sync-pagure.j2 index 5c6c03e744..f3af10cfb8 100755 --- a/roles/bodhi2/backend/templates/owner-sync-pagure.j2 +++ b/roles/bodhi2/backend/templates/owner-sync-pagure.j2 @@ -138,12 +138,18 @@ def get_repo_name_and_arches(tag, version): return repo_name, arches +def get_pagure_projects(namespace): + url = urljoin(PAGURE_URL, 'api/0/projects?namespace={0}'.format(namespace)) + url = url + "&page=1&per_page=50" + while url: + response = requests.get(url, verify=VERIFY).json() + for project in response['projects']: + yield project + url = response['pagination']['next'] + + def get_project_ownership(tag, namespace): - PAGURE_PROJECTS_API_URL = \ - urljoin(PAGURE_URL, 'api/0/projects?namespace={0}'.format(namespace)) - projects_rv = requests.get(PAGURE_PROJECTS_API_URL, verify=VERIFY).json() - projects = {} - for project in projects_rv['projects']: + for project in get_pagure_projects(namespace=namespace): # Check if this project has the branch we are interested in project_branches_url = '{0}api/0/{1}/{2}/git/branches'.format( PAGURE_URL, namespace, project['name'])