Also fix gateway slave

Signed-off-by: Patrick Uiterwijk <puiterwijk@redhat.com>
This commit is contained in:
Patrick Uiterwijk 2016-12-01 11:55:21 +00:00
parent f79388f24e
commit cb62d23a96
2 changed files with 50 additions and 0 deletions

View 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:

View file

@ -11,6 +11,13 @@
- fedmsg/gateway
- fedmsg/gateway/slave
- 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: Copy in empty endpoints.py and gateway.py
copy: src={{item}} dest=/etc/fedmsg.d/{{item}}
with_items: