Skip to content

Commit

Permalink
Handle invalid team name in config file
Browse files Browse the repository at this point in the history
  • Loading branch information
dregad committed May 6, 2021
1 parent d9cdcca commit e2c62ae
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions github_plugin_teams.py
Expand Up @@ -29,10 +29,17 @@ def retrieve_teams(org):
Returns a list of Team objects for the names defined in github_teams
that have fewer repositories than the specified organization
"""
teams = []
teams = {}
for team in org.get_teams():
if team.name in cfg.github['teams']:
teams.append(team)
teams[team.name] = team

# Check for invalid team names in config file
invalid = set(cfg.github['teams']) - set(teams)
if invalid:
print "Unknown teams specified in configuration:", ', '.join(invalid)
sys.exit(1)

return teams


Expand Down Expand Up @@ -77,7 +84,7 @@ def main():

# Check that the team grants access to each of the org's repo
# Add write access if not
for team in teams:
for team in teams.values():
print "Processing team '{0}'".format(team.name)
count = 0

Expand Down

0 comments on commit e2c62ae

Please sign in to comment.