From e57d8da92168ee968e98904da678085713e56cda Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Thu, 5 Sep 2019 20:24:24 +0000 Subject: [PATCH] Add appointment placeholders in governance updates When no candidate is supplied for a PTL position, replace the PTL entry for that project with a placeholder pending subsequent governance changes in which the TC will set appointments. Change-Id: I24ab692425f57d53669bc69094e72e744c868a25 --- openstack_election/cmds/update_governance.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/openstack_election/cmds/update_governance.py b/openstack_election/cmds/update_governance.py index aa46642f..6b17b5d6 100644 --- a/openstack_election/cmds/update_governance.py +++ b/openstack_election/cmds/update_governance.py @@ -70,9 +70,19 @@ def update_projects(projects_fname, candidates_list, projects): if match: project_count += 1 p = utils.name2dir(match.group(1)) - candidates = candidates_list['candidates'][p] + try: + candidates = candidates_list['candidates'][p] + except KeyError: + # Add placeholder for required TC appointment in cases + # where there is no candidate + candidates = [{ + 'fullname': 'APPOINTMENT NEEDED', + 'ircname': 'No nick supplied', + 'email': 'example@example.org', + }] + print('TC to appoint PTL for %s' % (p)) nr_candidates = len(candidates) - # Only update the PTL if there is a sinble candidate + # Only update the PTL if there is a single candidate if nr_candidates == 1: line += ((' ptl:\n' + ' name: %(fullname)s\n' + @@ -83,9 +93,6 @@ def update_projects(projects_fname, candidates_list, projects): # just written out new record so skip the next 4 lines in # the projects file. skip = 4 - # Projects with no candidates need to be appointed by the TC - elif nr_candidates == 0: - print('Skipping %s TC to appiont' % (p)) else: print('Skipping %s election in progress %d candidates' % (p, nr_candidates))