diff options
| author | Martin Krizek <mkrizek@redhat.com> | 2016-12-01 13:48:13 +0000 |
|---|---|---|
| committer | Martin Krizek <mkrizek@redhat.com> | 2016-12-01 13:48:13 +0000 |
| commit | 481bdb02090723c3236b380be9407e0fe1d871fe (patch) | |
| tree | 102cdbc4f6b8e098e69e68f747b10abc248f5a06 /roles/taskotron/taskotron-trigger/files | |
| parent | 0b76dd4cb5439c79bad586525837377e0d267aaa (diff) | |
| download | ansible-481bdb02090723c3236b380be9407e0fe1d871fe.tar.gz ansible-481bdb02090723c3236b380be9407e0fe1d871fe.tar.xz ansible-481bdb02090723c3236b380be9407e0fe1d871fe.zip | |
taskotron-trigger: hotfix fedmsg-consumer
Diffstat (limited to 'roles/taskotron/taskotron-trigger/files')
| -rw-r--r-- | roles/taskotron/taskotron-trigger/files/fedmsg-consumer-hotfix.patch | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/roles/taskotron/taskotron-trigger/files/fedmsg-consumer-hotfix.patch b/roles/taskotron/taskotron-trigger/files/fedmsg-consumer-hotfix.patch new file mode 100644 index 000000000..0736f8f25 --- /dev/null +++ b/roles/taskotron/taskotron-trigger/files/fedmsg-consumer-hotfix.patch @@ -0,0 +1,57 @@ +From 922c6f390525faa9a9d65a501a44d8081940194a Mon Sep 17 00:00:00 2001 +From: Patrick Uiterwijk <puiterwijk@redhat.com> +Date: Thu, 1 Dec 2016 11:56:34 +0000 +Subject: [PATCH] Only check for stomp messages after we decoded any ZMQMessage + +Signed-off-by: Patrick Uiterwijk <puiterwijk@redhat.com> +--- + fedmsg/consumers/__init__.py | 24 ++++++++++++------------ + 1 file changed, 12 insertions(+), 12 deletions(-) + +diff --git a/fedmsg/consumers/__init__.py b/fedmsg/consumers/__init__.py +index 88324b1..a12a587 100644 +--- a/fedmsg/consumers/__init__.py ++++ b/fedmsg/consumers/__init__.py +@@ -204,16 +204,23 @@ def _make_query(page=1): + + 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 +- + if hasattr(message, '__json__'): + message = message.__json__() + if isinstance(message['body'], basestring): + message['body'] = json.loads(message['body']) + ++ # Massage STOMP messages into a more compatible format. ++ if 'topic' not in message['body']: ++ message['body'] = { ++ 'topic': message.get('topic'), ++ 'msg': message['body'], ++ } ++ ++ # 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 ++ + # We assume these match inside fedmsg.crypto, so we should enforce it. + if not message['topic'] == message['body']['topic']: + raise RuntimeWarning("Topic envelope mismatch.") +@@ -223,13 +230,6 @@ def validate(self, 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: |
