Make the PTL tool more human friendly

Currently the PTL command has 2 issues that make it slightly hard to use.
1. $ ptl qa
   No official team 'qa'
   Traceback (most recent call last):
     File ".tox/venv/bin/ptl", line 10, in <module>
       sys.exit(main())
     File "/Users/tony8129/projects/openstack/openstack-infra/release-tools/releasetools/cmds/ptl.py", line 110, in main
       ptl = team['ptl']
   KeyError: 'ptl'
  Even though we know there isn't a team entry we still try to read the ptl key
2. $ ptl "stable branch maintenance"
   usage: ptl [-h] team
   ptl: error: unrecognized arguments: branch maintenance
   There appears to be no way to pass a team name with a space.

This change:
1. Only prints the team data if it seems valid
2. Handles teams with embed spaces
3. Adds to aliases for teams as I really want to look up 'qa' rather than
   'quality assurance'

Change-Id: Id5d5b4ed633df4c84b0cb96f52269a82ade2b193
This commit is contained in:
Tony Breeds 2016-10-06 14:30:12 +11:00
parent a57b2c67f4
commit bbc45826e9
1 changed files with 18 additions and 1 deletions

View File

@ -20,6 +20,20 @@ from releasetools import governance
import mwclient
ALIASES = {
'chef': 'Chef OpenStack',
'app-catalog': 'Community App Catalog',
'infra': 'Infrastructure',
'charms': 'OpenStack Charms',
'docs': 'Documentation',
'ux': 'OpenStack UX',
'deb': 'Packaging-deb',
'rpm': 'Packaging-rpm',
'puppet': 'Puppet OpenStack',
'qa': 'Quality Assurance',
'relmgt': 'Release Management',
'stable': 'Stable branch maintenance',
}
_TEMPLATE = '''
Name : {name}
@ -79,11 +93,14 @@ def get_wiki_table(page_content, section):
def main():
parser = argparse.ArgumentParser()
parser.add_argument(
'team',
'team', nargs='+',
help='the team name',
)
args = parser.parse_args()
args.team = ' '.join(args.team)
args.team = ALIASES.get(args.team.lower(), args.team)
team_data = governance.get_team_data()
# Allow for case-insensitive search
teams = {