summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2015-11-11 12:09:33 -0800
committerJoshua Harlow <harlowja@yahoo-inc.com>2015-11-11 12:10:47 -0800
commit84c24c008109423a165d6ee01f69857f7fc504be (patch)
treef9d7b7d3ededfdc1397310b6ed174a3e9c6e47b5
parent43d3fd31d8a1b87fedbc8b88e5de83cf446ffa7d (diff)
downloadoslo-incubator-84c24c008109423a165d6ee01f69857f7fc504be.tar.gz
Add a new core recruit tool/template/script
Change-Id: Ie159ff77bc48c1209d066f9342cb9ee2405985ea
-rwxr-xr-xtools/new_core_recruit.py70
1 files changed, 70 insertions, 0 deletions
diff --git a/tools/new_core_recruit.py b/tools/new_core_recruit.py
new file mode 100755
index 00000000..742d07e9
--- /dev/null
+++ b/tools/new_core_recruit.py
@@ -0,0 +1,70 @@
+#!/usr/bin/env python
+#
+# 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 random
+import sys
+
+import jinja2
+import parawrap
+
+
+def expand_template(contents, params):
+ if not params:
+ params = {}
+ tpl = jinja2.Template(source=contents, undefined=jinja2.StrictUndefined)
+ return tpl.render(**params)
+
+
+chosen_how = [
+ 'selected',
+ 'picked',
+ 'targeted',
+]
+new_oslo_core_tpl = """
+Hi {{firstname}} {{lastname}},
+
+You have been {{chosen_how}} to be a new {{project}} core (if you are
+willing to accept this mission). We have been watching your commits and
+reviews and have noticed that you may be interested in a core position
+that would be granted to you (if you are willing to accept the
+responsibility of being a new core member[1] in project {{project}}).
+
+What do you think, are you able (and willing) to accept?
+
+If you have any questions, please feel free to respond or jump on
+freenode and chat with the team on channel #openstack-oslo (one of the
+other cores in oslo usually around).
+
+This message will self-destruct in 5 seconds.
+
+Sincerely,
+
+The Oslo Team
+
+[1] http://docs.openstack.org/infra/manual/core.html
+"""
+firstname = sys.argv[1]
+lastname = sys.argv[2]
+tpl_args = {
+ 'firstname': firstname,
+ 'project': sys.argv[3],
+ 'lastname': lastname,
+ 'firstname_title': firstname.title(),
+ 'lastname_title': lastname.title(),
+ 'chosen_how': random.choice(chosen_how),
+}
+
+tpl_value = expand_template(new_oslo_core_tpl.lstrip(), tpl_args)
+tpl_value = parawrap.fill(tpl_value)
+print(tpl_value)