From: Frank Brehm Date: Mon, 13 Feb 2017 15:03:22 +0000 (+0100) Subject: Fixing lib/webhooks/__init__.py for the case not committers were found. X-Git-Tag: 0.8.4~37^2 X-Git-Url: https://git.uhu-banane.org/?a=commitdiff_plain;h=a7c5a8753a6ba65b13c8720f99473b89589392e5;p=pixelpark%2Fpuppetmaster-webhooks.git Fixing lib/webhooks/__init__.py for the case not committers were found. --- diff --git a/lib/webhooks/__init__.py b/lib/webhooks/__init__.py index 52d4672..4bafe80 100644 --- a/lib/webhooks/__init__.py +++ b/lib/webhooks/__init__.py @@ -1,6 +1,6 @@ #!/bin/env python3 # -*- coding: utf-8 -*- -__version__ = '0.3.5' +__version__ = '0.3.6' # vim: ts=4 et list diff --git a/lib/webhooks/deploy.py b/lib/webhooks/deploy.py index 1552a4b..ca32149 100644 --- a/lib/webhooks/deploy.py +++ b/lib/webhooks/deploy.py @@ -580,11 +580,14 @@ class WebhookDeployApp(object): timestamp = datetime.datetime.strptime(ts_str, timeformat) email = commit['author']['email'] committers.append((timestamp, email)) - committers.sort() - if self.verbose > 1: - LOG.debug("Got committers: {}".format(pp(committers))) - self.mail_to_addresses.append(committers[-1][1]) + if committers: + committers.sort() + if self.verbose > 1: + LOG.debug("Got committers: {}".format(pp(committers))) + self.mail_to_addresses.append(committers[-1][1]) + else: + LOG.debug("No committers found to append a mail address.") if 'git_ssh_url' in self.json_data['project']: self.git_ssh_url = self.json_data['project']['git_ssh_url']