add a "ptl" command to show info about how to contact a PTL

It's often faster to run a command line program than bring up the team
web page.

Change-Id: I743de291e6743c1106cebd1c7c1d754848af37f2
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2016-06-23 12:00:26 -04:00
parent 53b9c756a5
commit 7fc9059444
3 changed files with 70 additions and 0 deletions

View File

@ -426,6 +426,21 @@ changes, and push the patch to gerrit.
$ propose-final-releases -r ~/repos/openstack/releases mitaka
ptl
---
Report information about the PTL of a project by querying the
governance repository.
::
$ ptl "release management"
Name : Doug Hellmann
IRC Nick : dhellmann
IRC Channel : openstack-release
Email : doug@doughellmann.com
Base tools
==========

54
releasetools/cmds/ptl.py Normal file
View File

@ -0,0 +1,54 @@
# 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.
from __future__ import print_function
import argparse
from releasetools import governance
_TEMPLATE = '''
Name : {name}
IRC Nick : {irc}
IRC Channel : {irc_channel}
Email : {email}
'''
def main():
parser = argparse.ArgumentParser()
parser.add_argument(
'team',
help='the team name',
)
args = parser.parse_args()
team_data = governance.get_team_data()
# Allow for case-insensitive search
teams = {
n.lower(): i
for n, i in team_data.items()
}
try:
team = teams[args.team.lower()]
except KeyError:
print('ERROR: No team {!r}'.format(args.team))
else:
ptl = team['ptl']
print(_TEMPLATE.format(
name=ptl.get('name'),
irc=ptl.get('irc'),
email=ptl.get('email'),
irc_channel=team.get('irc-channel'),
))

View File

@ -39,3 +39,4 @@ console_scripts =
update-reviews = releasetools.cmds.update_reviews:main
propose-final-releases = releasetools.cmds.propose_final_releases:main
latest-deliverable-versions = releasetools.cmds.latest_deliverable_versions:main
ptl = releasetools.cmds.ptl:main