Adds the script used to send summit invitations to ATC
Change-Id: If67bdf6099067e96dc168027db6e8f5ee7e4b4cb Closes-Bug: #1243930
This commit is contained in:
parent
f25e08a588
commit
80875944b7
2
.gitignore
vendored
2
.gitignore
vendored
@ -10,3 +10,5 @@ manifests/secrets.pp
|
||||
openstack_infra_config.egg-info/
|
||||
/.project
|
||||
/.pydevproject
|
||||
tools/invite2summit/settings.py
|
||||
tools/invite2summit/done*
|
||||
|
15
tools/invite2summit/README
Normal file
15
tools/invite2summit/README
Normal file
@ -0,0 +1,15 @@
|
||||
It sends codes from codes.csv to ATCs in atc.csv and outputs a csv file
|
||||
with which name corresponds to which code.
|
||||
|
||||
You use it like this:
|
||||
|
||||
- Copy settings.py.sample to settings.py
|
||||
- Update values in settings.py, especially EMAIL_USER, EMAIL_FROM,
|
||||
EMAIL_SIGNATURE and EMAIL_PASSWORD
|
||||
- Run a test with "python send.py atc_sample.csv codes_sample.csv"
|
||||
|
||||
Should work on stock Ubuntu.
|
||||
|
||||
When ready, run the real thing with:
|
||||
|
||||
$ python send.py atc.csv codes.csv > sent.csv
|
3
tools/invite2summit/atc_sample.csv
Normal file
3
tools/invite2summit/atc_sample.csv
Normal file
@ -0,0 +1,3 @@
|
||||
stef,Stefano Maffulli,stefano@openstack.org
|
||||
mark,Mark Collier,mark@openstack.org
|
||||
lauren,Lauren Sell,lauren@openstack.org
|
|
3
tools/invite2summit/codes_sample.csv
Normal file
3
tools/invite2summit/codes_sample.csv
Normal file
@ -0,0 +1,3 @@
|
||||
LILCFRL,,
|
||||
TEST,,
|
||||
TESTING,,
|
|
3
tools/invite2summit/sample.atc.csv
Normal file
3
tools/invite2summit/sample.atc.csv
Normal file
@ -0,0 +1,3 @@
|
||||
reed, Stefano Maffulli,stefano@openstack.org,stefano@maffulli.net
|
||||
sparky,Mark Collier,sparkycollier@gmail.com,mark@openstack.org
|
||||
claire,Claire Massey,claire@openstack.org
|
|
77
tools/invite2summit/send.py
Normal file
77
tools/invite2summit/send.py
Normal file
@ -0,0 +1,77 @@
|
||||
# Summit passcode-sending application
|
||||
#
|
||||
# Copyright 2013 Thierry Carrez <thierry@openstack.org>
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import csv
|
||||
import settings
|
||||
import smtplib
|
||||
import sys
|
||||
import time
|
||||
from string import Template
|
||||
|
||||
|
||||
class ATC(object):
|
||||
def __init__(self, row):
|
||||
self.lpid = row[0]
|
||||
self.name = row[1]
|
||||
self.emails = row[2:]
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
if len(sys.argv) != 3:
|
||||
print "Usage: %s atc.csv codes.csv" % sys.argv[0]
|
||||
sys.exit(1)
|
||||
|
||||
atcfile = sys.argv[1]
|
||||
codesfile = sys.argv[2]
|
||||
|
||||
committers = []
|
||||
with open(atcfile, 'r') as f:
|
||||
reader = csv.reader(f)
|
||||
for row in reader:
|
||||
committers.append(ATC(row))
|
||||
|
||||
codes = []
|
||||
with open(codesfile, 'r') as f:
|
||||
reader = csv.reader(f)
|
||||
for row in reader:
|
||||
codes.append(row[0])
|
||||
|
||||
for committer, code in zip(committers, codes):
|
||||
if settings.EMAIL_USE_SSL:
|
||||
session = smtplib.SMTP_SSL(settings.EMAIL_HOST, settings.EMAIL_PORT)
|
||||
else:
|
||||
session = smtplib.SMTP(settings.EMAIL_HOST, settings.EMAIL_PORT)
|
||||
if settings.EMAIL_USE_TLS:
|
||||
session.starttls()
|
||||
session.login(settings.EMAIL_USER, settings.EMAIL_PASSWORD)
|
||||
session.set_debuglevel(settings.EMAIL_DEBUGLEVEL)
|
||||
|
||||
template = Template(settings.EMAIL_TEMPLATE)
|
||||
content = template.substitute(name=committer.name,
|
||||
code=code,
|
||||
signature=settings.EMAIL_SIGNATURE)
|
||||
msg = "From: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n%s" % (
|
||||
settings.EMAIL_FROM,
|
||||
','.join(committer.emails),
|
||||
settings.EMAIL_SUBJECT,
|
||||
content)
|
||||
|
||||
session.sendmail(settings.EMAIL_FROM, committer.emails, msg)
|
||||
print "%s,ATC,%s" % (code, committer.name)
|
||||
session.quit()
|
||||
time.sleep(settings.EMAIL_PAUSE)
|
53
tools/invite2summit/settings.py.sample
Normal file
53
tools/invite2summit/settings.py.sample
Normal file
@ -0,0 +1,53 @@
|
||||
# Settings for the passcode-sending application
|
||||
#
|
||||
# Copyright 2013 Thierry Carrez <thierry@openstack.org>
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
EMAIL_SUBJECT = "Your registration code for OpenStack Summit in Portland"
|
||||
|
||||
EMAIL_TEMPLATE = """
|
||||
Hello $name,
|
||||
|
||||
As you may already know, we'll be having our next OpenStack Summit
|
||||
in Portland from April 15 to April 18, 2013. We issue free passes to
|
||||
recent contributors to encourage them to join the OpenStack Summit
|
||||
and participate to shaping the next release at the Design Summit.
|
||||
|
||||
You've been identified as a contributor in the Folsom and/or Grizzly
|
||||
development cycles and therefore have been granted a personal code
|
||||
for free registration to the whole event. Please use the following
|
||||
code:
|
||||
|
||||
$code
|
||||
|
||||
The registration site should open sometimes next week. Feel free to
|
||||
email me with any question you may have.
|
||||
|
||||
Regards,
|
||||
|
||||
--
|
||||
$signature
|
||||
"""
|
||||
|
||||
EMAIL_FROM = "thierry@openstack.org"
|
||||
EMAIL_SIGNATURE = "Thierry Carrez\nOpenStack Foundation"
|
||||
EMAIL_HOST = "secure.emailsrvr.com"
|
||||
EMAIL_PORT = 465
|
||||
EMAIL_USER = "thierry.carrez@openstack.org"
|
||||
EMAIL_PASSWORD = "MYPASSWORDHERE"
|
||||
EMAIL_USE_SSL = True
|
||||
EMAIL_USE_TLS = False
|
||||
EMAIL_DEBUGLEVEL = 0
|
||||
EMAIL_PAUSE = 2
|
Loading…
Reference in New Issue
Block a user