Merge pull request #2129 from coreos-inc/fix-gh-npe

Fix KeyError in Github trigger setup
This commit is contained in:
josephschorr 2016-11-17 11:59:49 -05:00 committed by GitHub
commit 08d33ad08c

View file

@ -358,10 +358,13 @@ class GithubBuildTrigger(BuildTriggerHandler):
[{'kind': 'tag', 'name': tag} for tag in tags])
config = self.config
source = config.get('build_source')
if source is None:
return []
if field_name == 'tag_name':
try:
gh_client = self._get_client()
source = config['build_source']
repo = gh_client.get_repo(source)
gh_tags = repo.get_tags()
if limit:
@ -378,7 +381,6 @@ class GithubBuildTrigger(BuildTriggerHandler):
if field_name == 'branch_name':
try:
gh_client = self._get_client()
source = config['build_source']
repo = gh_client.get_repo(source)
gh_branches = repo.get_branches()
if limit: