Fix PEP8 errors

Mostly these should be obvious whitespace only changes.  The change to
owners.py (at approximately line 350 is mod complex as it switches from
an explicit if/elif/else construct to using the .get() method on a
dictionary

Change-Id: I34a56f48a92bf838299dd1026ad43423031012aa
This commit is contained in:
Tony Breeds 2018-04-12 12:30:13 +10:00
parent 6744d41057
commit 0ca941a3cb
4 changed files with 305 additions and 270 deletions

View File

@ -21,8 +21,8 @@ import yaml
from docutils import nodes from docutils import nodes
from docutils.parsers.rst import Directive from docutils.parsers.rst import Directive
from docutils.statemachine import ViewList from docutils.statemachine import ViewList
from sphinx.util.nodes import nested_parse_with_titles
from openstack_election import utils from openstack_election import utils
from sphinx.util.nodes import nested_parse_with_titles
def render_template(template, data, **kwargs): def render_template(template, data, **kwargs):

View File

@ -19,12 +19,9 @@ import glob
import hashlib import hashlib
import os import os
import shutil import shutil
import sys
import tempfile import tempfile
import time import time
from six.moves.urllib.request import urlopen
from openstack_election import owners from openstack_election import owners
from openstack_election import utils from openstack_election import utils

View File

@ -1,261 +1,286 @@
from __future__ import print_function
from __future__ import unicode_literals
from openstack_elections import config
from openstack_elections import utils
conf = config.load_config()
REFERENCE_URL = '%s?id=%s' (utils.PROJECTS_URL, conf['tag'])
LEADERLESS_URL = ('http://governance.openstack.org/resolutions/'
'20141128-elections-process-for-leaderless-programs.html')
def ptl_election_season(): def ptl_election_season():
email_text= """ email_text = """
Election details: https://governance.openstack.org/election/ Election details: https://governance.openstack.org/election/
Please read the stipulations and timelines for candidates and Please read the stipulations and timelines for candidates and
electorate contained in this governance documentation. electorate contained in this governance documentation.
Please note, if only one candidate is nominated as PTL for a program Please note, if only one candidate is nominated as PTL for a program
during the PTL nomination period, that candidate will win by acclaim, during the PTL nomination period, that candidate will win by acclaim,
and there will be no poll. There will only be a poll if there is more and there will be no poll. There will only be a poll if there is more
than one candidate stepping forward for a program's PTL position. than one candidate stepping forward for a program's PTL position.
There will be further announcements posted to the mailing list as There will be further announcements posted to the mailing list as
action is required from the electorate or candidates. This email action is required from the electorate or candidates. This email
is for information purposes only. is for information purposes only.
If you have any questions which you feel affect others please reply If you have any questions which you feel affect others please reply
to this email thread. to this email thread.
If you have any questions that you which to discuss in private please If you have any questions that you which to discuss in private please
email any of the election officials[1] so that we may address your email any of the election officials[1] so that we may address your
concerns. concerns.
Thank you, Thank you,
[1] https://governance.openstack.org/election/#election-officials"""
[1] https://governance.openstack.org/election/#election-officials"""
print(email_text) print(email_text)
def ptl_nominations_kickoff(nom_end_date, time_frame, starting_release, ending_release, future_release, email_deadline):
email_text= """
Nominations for OpenStack PTLs (Program Team Leads) are now open
and will remain open until %s.
All nominations must be submitted as a text file to the def ptl_nominations_kickoff(nom_end_date, time_frame, starting_release,
openstack/election repository as explained at ending_release, future_release, email_deadline):
http://governance.openstack.org/election/#how-to-submit-your-candidacy email_text = """
Nominations for OpenStack PTLs (Program Team Leads) are now open
and will remain open until %s.
Please make sure to follow the new candidacy file naming All nominations must be submitted as a text file to the
convention: $cycle_name/$project_name/$ircname.txt. openstack/election repository as explained at
http://governance.openstack.org/election/#how-to-submit-your-candidacy
In order to be an eligible candidate (and be allowed to vote) in Please make sure to follow the new candidacy file naming
a given PTL election, you need to have contributed to the corresponding convention: $cycle_name/$project_name/$ircname.txt.
team[0] during the %s timeframe (%s to %s). You must also be an OpenStack
Foundation Individual Member in good standing. To check if your membership
is up to date, go to https://www.openstack.org/community/members and
search for your name.
Additional information about the nomination process can be found here: In order to be an eligible candidate (and be allowed to vote) in
https://governance.openstack.org/election/ a given PTL election, you need to have contributed to the corresponding
team[0] during the %s timeframe (%s to %s). You must also be an OpenStack
Foundation Individual Member in good standing. To check if your membership
is up to date, go to https://www.openstack.org/community/members and
search for your name.
Shortly after election officials approve candidates, they will be listed here: Additional information about the nomination process can be found here:
https://governance.openstack.org/election/#%s-ptl-candidates https://governance.openstack.org/election/
The electorate is requested to confirm their email address in gerrit[1], Shortly after election officials approve candidates, they will be listed here:
prior to %s so that the emailed ballots are mailed to the correct email https://governance.openstack.org/election/#%s-ptl-candidates
address. This email address should match that which was provided in your
foundation member profile[2] as well.
Happy running, The electorate is requested to confirm their email address in gerrit[1],
prior to %s so that the emailed ballots are mailed to the correct email
address. This email address should match that which was provided in your
foundation member profile[2] as well.
[0] https://governance.openstack.org/tc/reference/projects/ Happy running,
[1] https://review.openstack.org/#/settings/contact
[2] https://www.openstack.org/profile/"""
print(email_text % (nom_end_date, time_frame, starting_release, ending_release, future_release, email_deadline)) [0] https://governance.openstack.org/tc/reference/projects/
[1] https://review.openstack.org/#/settings/contact
[2] https://www.openstack.org/profile/"""
print(email_text % (nom_end_date,
time_frame,
starting_release,
ending_release,
future_release,
email_deadline))
def ptl_nominations_last_days(num_projects_without_candidates): def ptl_nominations_last_days(num_projects_without_candidates):
email_text= """ email_text = """
A quick reminder that we are in the last hours for PTL candidate A quick reminder that we are in the last hours for PTL candidate
nominations. nominations.
If you want to stand for PTL, don't delay, follow the instructions If you want to stand for PTL, don't delay, follow the instructions
at [1] to make sure the community knows your intentions. at [1] to make sure the community knows your intentions.
Make sure your nomination has been submitted to the openstack/election Make sure your nomination has been submitted to the openstack/election
repository and approved by election officials. repository and approved by election officials.
Election statistics[2]: Election statistics[2]:
This means that with approximately 2 days left, %s projects will This means that with approximately 2 days left, %s projects will
be deemed leaderless. In this case the TC will oversee PTL selection as be deemed leaderless. In this case the TC will oversee PTL selection as
described by [3]. described by [3].
Thank you, Thank you,
[1] http://governance.openstack.org/election/#how-to-submit-your-candidacy [1] http://governance.openstack.org/election/#how-to-submit-your-candidacy
[2] Assuming the open reviews below are validated [2] Assuming the open reviews below are validated
https://review.openstack.org/#/q/is:open+project:openstack/election https://review.openstack.org/#/q/is:open+project:openstack/election
[3] http://governance.openstack.org/resolutions/20141128-elections-process-for-leaderless-programs.html""" [3] %s"""
print(email_text % (num_projects_without_candidates, LEADERLESS_URL))
print(email_text % (num_projects_without_candidates))
def ptl_end_nominations(projects_no_candidates, def ptl_end_nominations(projects_no_candidates,
list_projects_no_candidates, projects_polling, list_projects_no_candidates, projects_polling,
list_projects_polling, future_release): list_projects_polling, future_release):
email_text= """ email_text = """
The PTL Nomination period is now over. The official candidate list The PTL Nomination period is now over. The official candidate list
is available on the election website[0]. is available on the election website[0].
There are %s projects without candidates, so according to this There are %s projects without candidates, so according to this
resolution[1], the TC will have to decide how the following resolution[1], the TC will have to decide how the following
projects will proceed: %s projects will proceed: %s
There are %s projects that will have elections: %s. The details There are %s projects that will have elections: %s. The details
for those will be posted shortly after we setup the CIVS system. for those will be posted shortly after we setup the CIVS system.
Thank you, Thank you,
[0] http://governance.openstack.org/election/#%s-ptl-candidates [0] http://governance.openstack.org/election/#%s-ptl-candidates
[1] http://governance.openstack.org/resolutions/20141128-elections-process-for-leaderless-programs.html""" [1] %s"""
print(email_text % (projects_no_candidates, print(email_text % (projects_no_candidates,
list_projects_no_candidates, list_projects_no_candidates,
projects_polling, projects_polling,
list_projects_polling, future_release)) list_projects_polling,
future_release,
LEADERLESS_URL))
def ptl_voting_kickoff(election_end, list_of_elections, time_frame, starting_release, ending_release, future_release, repo_tag):
email_text= """
Polls for PTL elections are now open and will remain open for you to
cast your vote until %s.
We are having elections for %s. def ptl_voting_kickoff(election_end, list_of_elections, time_frame,
starting_release, ending_release, future_release):
email_text = """
Polls for PTL elections are now open and will remain open for you to
cast your vote until %s.
If you are a Foundation individual member and had a commit in We are having elections for %s.
one of the program's projects[0] over the %s timeframe
(%s to %s) then you are eligible to vote. You should find your
email with a link to the Condorcet page to cast your vote in the
inbox of your gerrit preferred email[1].
What to do if you don't see the email and have a commit in at If you are a Foundation individual member and had a commit in
least one of the programs having an election: one of the program's projects[0] over the %s timeframe
* check the trash or spam folders of your gerrit Preferred (%s to %s) then you are eligible to vote. You should find your
email with a link to the Condorcet page to cast your vote in the
inbox of your gerrit preferred email[1].
What to do if you don't see the email and have a commit in at
least one of the programs having an election:
* check the trash or spam folders of your gerrit Preferred
Email address, in case it went into trash or spam Email address, in case it went into trash or spam
* wait a bit and check again, in case your email server is a bit slow * wait a bit and check again, in case your email server is a bit slow
* find the sha of at least one commit from the program * find the sha of at least one commit from the program
project repos[0] and email the election officials. project repos[0] and email the election officials.
If we can confirm that you are entitled to vote, we will add you If we can confirm that you are entitled to vote, we will add you
to the voters list for the appropriate election. to the voters list for the appropriate election.
Our democratic process is important to the health of OpenStack, Our democratic process is important to the health of OpenStack,
please exercise your right to vote! please exercise your right to vote!
Candidate statements/platforms can be found linked to Candidate Candidate statements/platforms can be found linked to Candidate
names on this page: names on this page:
http://governance.openstack.org/election/#%s-ptl-candidates http://governance.openstack.org/election/#%s-ptl-candidates
Happy voting, Happy voting,
[0] The list of the program projects eligible for electoral status: [0] The list of the program projects eligible for electoral status:
https://git.openstack.org/cgit/openstack/governance/tree/reference/projects.yaml?id=%s %s
[1] Sign into review.openstack.org: [1] Sign into review.openstack.org:
Go to Settings > Contact Information. Go to Settings > Contact Information.
Look at the email listed as your Preferred Email. Look at the email listed as your Preferred Email.
That is where the ballot has been sent.""" That is where the ballot has been sent."""
print(email_text % (election_end, print(email_text % (election_end,
list_of_elections, list_of_elections,
time_frame, time_frame,
starting_release, starting_release,
ending_release, ending_release,
future_release, future_release,
repo_tag)) REFERENCE_URL))
def ptl_voting_last_days(list_of_elections, election_end): def ptl_voting_last_days(list_of_elections, election_end):
email_text= """ email_text = """
Hello %s contributors, Hello %s contributors,
Just a quick reminder that elections are closing soon, if you haven't Just a quick reminder that elections are closing soon, if you haven't
already you should use your right to vote and pick your favourite already you should use your right to vote and pick your favourite
candidate! candidate!
You have until %s. You have until %s.
Thanks for your time!""" Thanks for your time!"""
print (email_text % (list_of_elections,
print(email_text % (list_of_elections,
election_end)) election_end))
def tc_election_season(): def tc_election_season():
email_text= """ email_text = """
Election details: https://governance.openstack.org/election/ Election details: https://governance.openstack.org/election/
Please read the stipulations and timelines for candidates and Please read the stipulations and timelines for candidates and
electorate contained in this governance documentation. electorate contained in this governance documentation.
There will be further announcements posted to the mailing list as There will be further announcements posted to the mailing list as
action is required from the electorate or candidates. This email action is required from the electorate or candidates. This email
is for information purposes only. is for information purposes only.
If you have any questions which you feel affect others please reply If you have any questions which you feel affect others please reply
to this email thread. to this email thread.
If you have any questions that you which to discuss in private please If you have any questions that you which to discuss in private please
email any of the election officials[1] so that we may address your email any of the election officials[1] so that we may address your
concerns. concerns.
Thank you, Thank you,
[1] https://governance.openstack.org/election/#election-officials"""
[1] https://governance.openstack.org/election/#election-officials"""
print(email_text) print(email_text)
def tc_nominations_kickoff(seats, end_nominations, voting_start, def tc_nominations_kickoff(seats, end_nominations, voting_start,
voting_end, time_frame, start_release, voting_end, time_frame, start_release,
end_release, start_nominations, end_nomination, end_release, start_nominations, end_nomination,
campaign_start, campaign_end, election_start, campaign_start, campaign_end, election_start,
election_end, future_release): election_end, future_release):
email_text=""" email_text = """
Nominations for the Technical Committee positions (%s positions) Nominations for the Technical Committee positions (%s positions)
are now open and will remain open until %s. are now open and will remain open until %s.
All nominations must be submitted as a text file to the All nominations must be submitted as a text file to the
openstack/election repository as explained on the election website[1]. openstack/election repository as explained on the election website[1].
Please note that the name of the file should match an email Please note that the name of the file should match an email
address in the foundation member profile of the candidate. address in the foundation member profile of the candidate.
Also for TC candidates election officials refer to the community Also for TC candidates election officials refer to the community
member profiles at [2] please take this opportunity to ensure that member profiles at [2] please take this opportunity to ensure that
your profile contains current information. your profile contains current information.
Candidates for the Technical Committee Positions: Any Foundation Candidates for the Technical Committee Positions: Any Foundation
individual member can propose their candidacy for an available, individual member can propose their candidacy for an available,
directly-elected TC seat. directly-elected TC seat.
The election will be held from %s through to %s. The electorate The election will be held from %s through to %s. The electorate
are the Foundation individual members that are also committers are the Foundation individual members that are also committers
for one of the official teams[3] over the %s timeframe (%s to for one of the official teams[3] over the %s timeframe (%s to
%s, as well as the extra-ATCs who are acknowledged by the TC[4]. %s, as well as the extra-ATCs who are acknowledged by the TC[4].
Please see the website[5] for additional details about this election. Please see the website[5] for additional details about this election.
Please find below the timeline: Please find below the timeline:
TC nomination starts @ %s TC nomination starts @ %s
TC nomination ends @ %s TC nomination ends @ %s
TC campaigning starts @ %s TC campaigning starts @ %s
TC campaigning ends @ %s TC campaigning ends @ %s
TC elections starts @ %s TC elections starts @ %s
TC elections ends @ %s TC elections ends @ %s
If you have any questions please be sure to either ask them on the If you have any questions please be sure to either ask them on the
mailing list or to the elections officials[6]. mailing list or to the elections officials[6].
Thank you, Thank you,
[1] http://governance.openstack.org/election/#how-to-submit-your-candidacy [1] http://governance.openstack.org/election/#how-to-submit-your-candidacy
[2] http://www.openstack.org/community/members/ [2] http://www.openstack.org/community/members/
[3] https://governance.openstack.org/tc/reference/projects/ [3] https://governance.openstack.org/tc/reference/projects/
[4] https://releases.openstack.org/%s/schedule.html#p-extra-atcs [4] https://releases.openstack.org/%s/schedule.html#p-extra-atcs
[5] https://governance.openstack.org/election/ [5] https://governance.openstack.org/election/
[6] http://governance.openstack.org/election/#election-officials""" [6] http://governance.openstack.org/election/#election-officials"""
print(email_text % (seats, print(email_text % (seats,
end_nominations, end_nominations,
@ -272,124 +297,130 @@ def tc_nominations_kickoff(seats, end_nominations, voting_start,
election_end, election_end,
future_release)) future_release))
def tc_nominations_last_days(end_nominations): def tc_nominations_last_days(end_nominations):
email_text= """ email_text = """
A quick reminder that we are in the last hours for TC A quick reminder that we are in the last hours for TC
candidate announcements. Nominations are open until %s. candidate announcements. Nominations are open until %s.
If you want to stand for TC, don't delay, follow the If you want to stand for TC, don't delay, follow the
instructions at [1] to make sure the community knows your instructions at [1] to make sure the community knows your
intentions. intentions.
Make sure your nomination has been submitted to the Make sure your nomination has been submitted to the
openstack/election repository and approved by election officials. openstack/election repository and approved by election officials.
Thank you, Thank you,
[1] http://governance.openstack.org/election/#how-to-submit-your-candidacy""" [1] http://governance.openstack.org/election/#how-to-submit-your-candidacy"""
print(email_text % (end_nominations)) print(email_text % (end_nominations))
def tc_end_nominations(future_release, election_start_day): def tc_end_nominations(future_release, election_start_day):
email_text= """ email_text = """
TC Nomination period is now over. The official candidate list is TC Nomination period is now over. The official candidate list is
available on the election website[0]. available on the election website[0].
Now begins the campaigning period where candidates and Now begins the campaigning period where candidates and
electorate may debate their statements. electorate may debate their statements.
Polling will start %s. Polling will start %s.
Thank you, Thank you,
[0] http://governance.openstack.org/election/#%s-tc-candidates""" [0] http://governance.openstack.org/election/#%s-tc-candidates"""
print(email_text % (future_release, election_start_day)) print(email_text % (future_release, election_start_day))
def tc_voting_kickoff(poll_end, seats, time_frame, start_release, def tc_voting_kickoff(poll_end, seats, time_frame, start_release,
end_release, repo_tag, future_release): end_release, future_release):
email_text= """ email_text = """
The poll for the TC Election is now open and will remain open until %s. The poll for the TC Election is now open and will remain open until %s.
We are selecting %s TC members, please rank all candidates in We are selecting %s TC members, please rank all candidates in
your order of preference. your order of preference.
You are eligible to vote if you are a Foundation individual member[1] You are eligible to vote if you are a Foundation individual member[1]
that also has committed to one of the official programs projects[2] that also has committed to one of the official programs projects[2]
over the %s timeframe (%s to %s) or if you are one of the over the %s timeframe (%s to %s) or if you are one of the
extra-atcs.[3] extra-atcs.[3]
What to do if you don't see the email and have a commit in at least What to do if you don't see the email and have a commit in at least
one of the official programs projects[2]: one of the official programs projects[2]:
* check the trash or spam folder of your gerrit Preferred Email * check the trash or spam folder of your gerrit Preferred Email
address[4], in case it went into trash or spam address[4], in case it went into trash or spam
* wait a bit and check again, in case your email server is a bit slow * wait a bit and check again, in case your email server is a bit slow
* find the sha of at least one commit from the program project * find the sha of at least one commit from the program project
repos[2] and email the election officials[1]. repos[2] and email the election officials[1].
If we can confirm that you are entitled to vote, we will If we can confirm that you are entitled to vote, we will
add you to the voters list and you will be emailed a ballot. add you to the voters list and you will be emailed a ballot.
Our democratic process is important to the health of OpenStack, Our democratic process is important to the health of OpenStack,
please exercise your right to vote. please exercise your right to vote.
Candidate statements/platforms can be found linked to Candidate Candidate statements/platforms can be found linked to Candidate
names[6]. names[6].
Happy voting! Happy voting!
Thank you, Thank you,
[1] http://www.openstack.org/community/members/ [1] http://www.openstack.org/community/members/
[2] https://git.openstack.org/cgit/openstack/governance/tree/reference/projects.yaml?id=%s [2] %s
[3] Look for the extra-atcs element in [2] [3] Look for the extra-atcs element in [2]
[4] Sign into review.openstack.org: Go to Settings > Contact Information. Look at the email listed as your [4] Sign into review.openstack.org: Go to Settings > Contact Information. Look
Preferred Email. That is where the ballot has been sent. at the email listed as your preferred email. That is where the ballot has
[5] http://governance.openstack.org/election/#election-officials been sent.
[6] http://governance.openstack.org/election/#%s-tc-candidates""" [5] http://governance.openstack.org/election/#election-officials
[6] http://governance.openstack.org/election/#%s-tc-candidates"""
print(email_text % (poll_end, print(email_text % (poll_end,
seats, seats,
time_frame, time_frame,
start_release, start_release,
end_release, end_release,
repo_tag, REFERENCE_URL,
future_release)) future_release))
def tc_voting_last_days(poll_end, poll_name, future_release, repo_tag):
email_text= """ def tc_voting_last_days(poll_end, poll_name, future_release):
We are coming down to the last hours for voting in the TC
election. Voting ends %s.
Search your gerrit preferred email address[0] for the following subject: email_text = """
We are coming down to the last hours for voting in the TC
election. Voting ends %s.
Search your gerrit preferred email address[0] for the following subject:
Poll: %s Poll: %s
That is your ballot and links you to the voting application. Please That is your ballot and links you to the voting application. Please
vote. If you have voted, please encourage your colleagues to vote. vote. If you have voted, please encourage your colleagues to vote.
Candidate statements are linked to the names of all confirmed Candidate statements are linked to the names of all confirmed
candidates: candidates:
http://governance.openstack.org/election/#%s-tc-candidates http://governance.openstack.org/election/#%s-tc-candidates
What to do if you don't see the email and have a commit in at least What to do if you don't see the email and have a commit in at least
one of the official programs projects[1]: one of the official programs projects[1]:
* check the trash of your gerrit Preferred Email address[0], in * check the trash of your gerrit Preferred Email address[0], in
case it went into trash or spam case it went into trash or spam
* wait a bit and check again, in case your email server is a bit slow * wait a bit and check again, in case your email server is a bit slow
* find the sha of at least one commit from the program project * find the sha of at least one commit from the program project
repos[1] and email the election officials[2]. repos[1] and email the election officials[2].
If we can confirm that you are entitled to vote, we will add you If we can confirm that you are entitled to vote, we will add you
to the voters list and you will be emailed a ballot. to the voters list and you will be emailed a ballot.
Please vote! Please vote!
Thank you, Thank you,
[0] Sign into review.openstack.org: Go to Settings > Contact [0] Sign into review.openstack.org: Go to Settings > Contact
Information. Look at the email listed as your Preferred Email. Information. Look at the email listed as your Preferred Email.
That is where the ballot has been sent. That is where the ballot has been sent.
[1] https://git.openstack.org/cgit/openstack/governance/tree/reference/projects.yaml?id=%s [1] %s
[2] http://governance.openstack.org/election/#election-officials""" [2] http://governance.openstack.org/election/#election-officials"""
print(email_text % (poll_end, poll_name, future_release, repo_tag))
print(email_text % (poll_end, poll_name, future_release, REFERENCE_URL))

View File

@ -112,17 +112,23 @@ def dumper(data, stream):
def normalize_email(email): def normalize_email(email):
"""Lower-case the domain part of E-mail addresses to better spot """Normalize email addresses to make it easier to spot duplicates
Lower-case the domain part of E-mail addresses to better spot
duplicate entries, since the domain part is case-insensitive duplicate entries, since the domain part is case-insensitive
courtesy of DNS while the local part is not necessarily""" courtesy of DNS while the local part is not necessarily
"""
local, domain = email.split('@') local, domain = email.split('@')
domain = domain.lower() domain = domain.lower()
return '%s@%s' % (local, domain) return '%s@%s' % (local, domain)
def normalize_project(project): def normalize_project(project):
"""Replace spaces and hyphens with underscores in project teams """Normalize project names for consistent failnames
and then lower-case them, for more convenient filenames"""
Replace spaces and hyphens with underscores in project teams
and then lower-case them, for more convenient filenames
"""
return project.translate(maketrans(' -', '__')).lower() return project.translate(maketrans(' -', '__')).lower()
@ -177,7 +183,7 @@ def decode_json(raw):
# Try to decode and bail with much detail if it fails # Try to decode and bail with much detail if it fails
try: try:
decoded = json.loads(trimmed) decoded = json.loads(trimmed)
except: except Exception:
print('\nrequest returned %s error to query:\n\n %s\n' print('\nrequest returned %s error to query:\n\n %s\n'
'\nwith detail:\n\n %s\n' % (raw, raw.url, trimmed), '\nwith detail:\n\n %s\n' % (raw, raw.url, trimmed),
file=sys.stderr) file=sys.stderr)
@ -212,8 +218,7 @@ def lookup_member(email):
MEMBER_LOOKUP_URL = 'https://openstackid-resources.openstack.org/' MEMBER_LOOKUP_URL = 'https://openstackid-resources.openstack.org/'
# URL pattern for querying foundation members by E-mail address # URL pattern for querying foundation members by E-mail address
raw = requester( raw = requester(MEMBER_LOOKUP_URL + '/api/public/v1/members',
MEMBER_LOOKUP_URL + '/api/public/v1/members',
params={'filter[]': [ params={'filter[]': [
'group_slug==foundation-members', 'group_slug==foundation-members',
'email==' + email, 'email==' + email,
@ -344,12 +349,10 @@ def main(argv=sys.argv):
{'h': ref}) {'h': ref})
for project in old_projects: for project in old_projects:
for deliverable in old_projects[project]['deliverables']: for deliverable in old_projects[project]['deliverables']:
if 'retired-on' in old_projects[project]['deliverables'][deliverable]: retired = old_projects[project]['deliverables'][deliverable].get(
retired = old_projects[project]['deliverables'][deliverable]['retired-on'] 'retired-on',
elif 'retired-on' in old_projects[project]: old_projects[project].get('retired-on')
retired = old_projects[project]['retired-on'] )
else:
retired = None
if retired: if retired:
retired = retired.isoformat() retired = retired.isoformat()
if after and after > retired: if after and after > retired:
@ -357,9 +360,12 @@ def main(argv=sys.argv):
if project not in gov_projects: if project not in gov_projects:
gov_projects[project] = {'deliverables': {}} gov_projects[project] = {'deliverables': {}}
if deliverable in gov_projects[project]['deliverables']: if deliverable in gov_projects[project]['deliverables']:
print('Skipping duplicate/partially retired deliverable: %s' % deliverable, file=sys.stderr) print(('Skipping duplicate/partially retired deliverable:'
' %s') % (deliverable),
file=sys.stderr)
continue continue
gov_projects[project]['deliverables'][deliverable] = old_projects[project]['deliverables'][deliverable] gov_projects[project]['deliverables'][deliverable] = \
old_projects[project]['deliverables'][deliverable]
# A mapping of short (no prefix) to full repo names existing in # A mapping of short (no prefix) to full repo names existing in
# Gerrit, used to handle repos which have a different namespace # Gerrit, used to handle repos which have a different namespace
@ -645,7 +651,7 @@ def main(argv=sys.argv):
if member['data']: if member['data']:
owners[owner]['member'] = member['data'][0]['id'] owners[owner]['member'] = member['data'][0]['id']
continue continue
invite = [owners[owner].get('member','0')] invite = [owners[owner].get('member', '0')]
invite.append(owners[owner]['name'].encode('utf-8')) invite.append(owners[owner]['name'].encode('utf-8'))
invite.append(owners[owner]['preferred']) invite.append(owners[owner]['preferred'])
invite += owners[owner]['extra'] invite += owners[owner]['extra']
@ -714,5 +720,6 @@ def main(argv=sys.argv):
fd.writelines(electorate) fd.writelines(electorate)
fd.close() fd.close()
if __name__ == "__main__": if __name__ == "__main__":
main() main()