diff --git a/roles/github2fedmsg/files/11776.patch b/roles/github2fedmsg/files/11776.patch new file mode 100644 index 0000000000..7da48dd9c5 --- /dev/null +++ b/roles/github2fedmsg/files/11776.patch @@ -0,0 +1,26 @@ +diff --git a/github2fedmsg/views/webhooks.py b/github2fedmsg/views/webhooks.py +index be6b707..0637143 100644 +--- a/github2fedmsg/views/webhooks.py ++++ b/github2fedmsg/views/webhooks.py +@@ -167,10 +167,19 @@ def build_fas_lookup(payload): + usernames = set() + + # Trawl through every possible corner we can to find github usernames ++ # Fix for https://pagure.io/fedora-infrastructure/issue/11776 + if 'commits' in payload: + for commit in payload['commits']: +- usernames.add(commit['committer']['username']) +- usernames.add(commit['author']['username']) ++ if 'committer' in commit: ++ if 'username' in commit['committer']: ++ usernames.add(commit['committer']['username']) ++ elif 'name' in commit['committer']: ++ usernames.add(commit['committer']['name']) ++ if 'author' in commit: ++ if 'username' in commit['author']: ++ usernames.add(commit['author']['username']) ++ elif 'name' in commit['author']: ++ usernames.add(commit['author']['name']) + + if 'pusher' in payload: + usernames.add(payload['pusher']['name']) diff --git a/roles/github2fedmsg/tasks/main.yml b/roles/github2fedmsg/tasks/main.yml index 19361b3d9a..082bdc2735 100644 --- a/roles/github2fedmsg/tasks/main.yml +++ b/roles/github2fedmsg/tasks/main.yml @@ -67,6 +67,17 @@ notify: - restart apache + # Fix for https://pagure.io/fedora-infrastructure/issue/11776 +- name: hotfix - Fix the KeyError when looking for user in github event + ansible.posix.patch: + src: 11776.patch + dest: /usr/lib/python2.7/site-packages/github2fedmsg/views/webhooks.py + tags: + - hotfix + - github2fedmsg + notify: + - restart apache + - name: ensure selinux lets httpd talk to postgres seboolean: name=httpd_can_network_connect_db persistent=yes state=yes tags: