Apply patch to fix fedmsg-gateway
Signed-off-by: Patrick Uiterwijk <puiterwijk@redhat.com>
This commit is contained in:
parent
93589b84a4
commit
f79388f24e
2 changed files with 50 additions and 0 deletions
43
roles/fedmsg/gateway/files/fixup.patch
Normal file
43
roles/fedmsg/gateway/files/fixup.patch
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
--- __init__.py.orig 2016-12-01 11:50:40.064820904 +0000
|
||||||
|
+++ __init__.py 2016-12-01 11:51:00.276026941 +0000
|
||||||
|
@@ -204,10 +204,12 @@
|
||||||
|
|
||||||
|
def validate(self, message):
|
||||||
|
""" This needs to raise an exception, caught by moksha. """
|
||||||
|
- # If we're not validating, then everything is valid.
|
||||||
|
- # If this is turned on globally, our child class can override it.
|
||||||
|
- if not self.validate_signatures:
|
||||||
|
- return
|
||||||
|
+ # Massage STOMP messages into a more compatible format.
|
||||||
|
+ if 'topic' not in message['body']:
|
||||||
|
+ message['body'] = {
|
||||||
|
+ 'topic': message.get('topic'),
|
||||||
|
+ 'msg': message['body'],
|
||||||
|
+ }
|
||||||
|
|
||||||
|
if hasattr(message, '__json__'):
|
||||||
|
message = message.__json__()
|
||||||
|
@@ -218,18 +220,15 @@
|
||||||
|
if not message['topic'] == message['body']['topic']:
|
||||||
|
raise RuntimeWarning("Topic envelope mismatch.")
|
||||||
|
|
||||||
|
+ # If we're not validating, then everything is valid.
|
||||||
|
+ # If this is turned on globally, our child class can override it.
|
||||||
|
+ if not self.validate_signatures:
|
||||||
|
+ return
|
||||||
|
+
|
||||||
|
if not fedmsg.crypto.validate(message['body'], **self.hub.config):
|
||||||
|
raise RuntimeWarning("Failed to authn message.")
|
||||||
|
|
||||||
|
def _consume(self, message):
|
||||||
|
-
|
||||||
|
- # Massage STOMP messages into a more compatible format.
|
||||||
|
- if 'topic' not in message['body']:
|
||||||
|
- message['body'] = {
|
||||||
|
- 'topic': message.get('topic'),
|
||||||
|
- 'msg': message['body'],
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
try:
|
||||||
|
self.validate(message)
|
||||||
|
except RuntimeWarning as e:
|
|
@ -4,6 +4,13 @@
|
||||||
- packages
|
- packages
|
||||||
- fedmsg/gateway
|
- fedmsg/gateway
|
||||||
|
|
||||||
|
- name: Apply fixing patch
|
||||||
|
patch: src=fixup.patch dest=/usr/lib/python2.7/site-packages/fedmsg/consumers/__init__.py
|
||||||
|
tags:
|
||||||
|
- packages
|
||||||
|
- fedmsg/gateway
|
||||||
|
- patch
|
||||||
|
|
||||||
- name: ensure that nrpe has rights to monitor us
|
- name: ensure that nrpe has rights to monitor us
|
||||||
file: >
|
file: >
|
||||||
dest=/var/run/fedmsg/monitoring-fedmsg-gateway.socket
|
dest=/var/run/fedmsg/monitoring-fedmsg-gateway.socket
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue