Last active
July 1, 2016 09:49
-
-
Save tbreeds/303c7edeb72eecf12c2d7cb754f485aa to your computer and use it in GitHub Desktop.
Read CPL information from OpenStack projects.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import copy | |
import pprint | |
import yaml | |
def loadit(): | |
with open('reference/projects.yaml') as f: | |
p = yaml.safe_load(f) | |
return p | |
def get_cpls(team='Stable branch maintenance', projects=None): | |
if projects is None: | |
projects = loadit() | |
cpls = [] | |
for k, v in projects.items(): | |
team_cpls = copy.copy(v.get('cpls', {}).get(team, []) or [v['ptl']]) | |
for cpl in team_cpls: | |
cpl.update({'from': k}) | |
cpls.append(cpl) | |
return cpls | |
def get_ptl(team, projects=None): | |
if projects is None: | |
projects = loadit() | |
return projects.get(team, {}).get('ptl') | |
def get_cpl(source, dest='Stable branch maintenance'): | |
return [x for x in get_cpls(team=dest) if x.get('from', '') == source] | |
pprint.pprint( get_cpl('glance', dest='Documentation') ) | |
pprint.pprint( get_cpl('glance', dest='Release Management') ) | |
pprint.pprint( get_cpl('zaqar') ) | |
pprint.pprint( get_cpl('trove') ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment