summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDobroslaw Zybort <dobroslaw.zybort@ts.fujitsu.com>2018-09-07 10:46:07 +0200
committerDobroslaw Zybort <dobroslaw.zybort@ts.fujitsu.com>2018-09-12 11:45:59 +0000
commitc8b9b81f61a2b7b49bb32d6865afbc6153b37db2 (patch)
tree19786d266aefdb060458e89bf8fe2d9595456142
parentbe267e3c104c6711713d0e6ee112b7cee1bd5987 (diff)
Py3: Fix encoding of message in RetryEngine
Notes
Notes (review): Code-Review+2: Adrian Czarnecki <adrian.czarnecki@ts.fujitsu.com> Workflow+1: Adrian Czarnecki <adrian.czarnecki@ts.fujitsu.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Wed, 12 Sep 2018 12:48:50 +0000 Reviewed-on: https://review.openstack.org/600676 Project: openstack/monasca-notification Branch: refs/heads/master
-rw-r--r--monasca_notification/retry_engine.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/monasca_notification/retry_engine.py b/monasca_notification/retry_engine.py
index 38a4fc1..4c8e346 100644
--- a/monasca_notification/retry_engine.py
+++ b/monasca_notification/retry_engine.py
@@ -17,11 +17,12 @@
17import json 17import json
18import time 18import time
19 19
20from monasca_common.kafka import consumer
21from monasca_common.kafka import producer
20from oslo_config import cfg 22from oslo_config import cfg
21from oslo_log import log as logging 23from oslo_log import log as logging
24from six import PY3
22 25
23from monasca_common.kafka import consumer
24from monasca_common.kafka import producer
25from monasca_notification.common.utils import construct_notification_object 26from monasca_notification.common.utils import construct_notification_object
26from monasca_notification.common.utils import get_db_repo 27from monasca_notification.common.utils import get_db_repo
27from monasca_notification.common.utils import get_statsd_client 28from monasca_notification.common.utils import get_statsd_client
@@ -51,6 +52,7 @@ class RetryEngine(object):
51 for raw_notification in self._consumer: 52 for raw_notification in self._consumer:
52 message = raw_notification[1].message.value 53 message = raw_notification[1].message.value
53 54
55 message = message.decode('UTF-8') if PY3 else message
54 notification_data = json.loads(message) 56 notification_data = json.loads(message)
55 57
56 notification = construct_notification_object(self._db_repo, notification_data) 58 notification = construct_notification_object(self._db_repo, notification_data)