Include retired projects/deliverables in elections

If a deliverable or entire project is retired within the qualifying
period for an election, those contributions still count toward
defining the electorate. Merge them into the list of official
projects under those circumstances, but check for any possible
duplicates in case of partial deliverable retirement for a
multi-repo deliverable.

Change-Id: If626373cdbc6ca9ad7d016b2e18b4d82a4ceaa23
Depends-On: I7ca3c9294d325085ce9139f3a86b55e5b31c79c7
This commit is contained in:
Jeremy Stanley 2017-07-28 17:22:24 +00:00
parent fb3e76576b
commit b2ad9b4f50

View File

@ -338,6 +338,36 @@ def main(argv=sys.argv):
'hb': ref,
})
# The set of retired or removed "legacy" projects from governance
# are merged into the main dict if their retired-on date falls
# later than the after parameter for the qualifying time period
# TODO(fungi): make this a configurable option
old_projects = query_gerrit(
'gitweb', {
'p': 'openstack/governance.git',
'a': 'blob_plain',
'f': 'reference/legacy.yaml',
'hb': ref,
})
for project in old_projects:
for deliverable in old_projects[project]['deliverables']:
if 'retired-on' in old_projects[project]['deliverables'][deliverable]:
retired = old_projects[project]['deliverables'][deliverable]['retired-on']
elif 'retired-on' in old_projects[project]:
retired = old_projects[project]['retired-on']
else:
retired = None
if retired:
retired = retired.isoformat()
if after and after > retired:
continue
if project not in gov_projects:
gov_projects[project] = {'deliverables': {}}
if deliverable in gov_projects[project]['deliverables']:
print('Skipping duplicate/partially retired deliverable: %s' % deliverable, file=sys.stderr)
continue
gov_projects[project]['deliverables'][deliverable] = old_projects[project]['deliverables'][deliverable]
# A mapping of short (no prefix) to full repo names existing in
# Gerrit, used to handle repos which have a different namespace
# in governance during transitions and also to filter out repos