summaryrefslogtreecommitdiffstats
path: root/events/src/utils.py
diff options
context:
space:
mode:
authorAravinda VK <avishwan@redhat.com>2019-02-21 11:25:55 +0530
committerAmar Tumballi <amarts@redhat.com>2019-02-25 15:30:19 +0000
commitcd68f7b88b9a2c9a4e4ff9fca61517384e54130a (patch)
treea3ce6f600e594e024c601aeef1c61669c51278a6 /events/src/utils.py
parentb2081cd8856a725c89c4d97b1399c589780b467a (diff)
eventsapi: Fix Python3 compatibility issues
- Fixed Relative import and non-package import related issues. - socketserver import issues fix - Renamed installed directory name to `gfevents` from `events`(To avoid any issues with other global libs) Fixes: bz#1679406 Change-Id: I3dc38bc92b23387a6dfbcc0ab8283178235bf756 Signed-off-by: Aravinda VK <avishwan@redhat.com>
Diffstat (limited to 'events/src/utils.py')
-rw-r--r--events/src/utils.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/events/src/utils.py b/events/src/utils.py
index fcdcbd47acc..38b707a1b28 100644
--- a/events/src/utils.py
+++ b/events/src/utils.py
@@ -9,6 +9,7 @@
# cases as published by the Free Software Foundation.
#
+import sys
import json
import os
import logging
@@ -26,13 +27,15 @@ import hmac
from hashlib import sha256
from calendar import timegm
-from .eventsapiconf import (LOG_FILE,
- WEBHOOKS_FILE,
- DEFAULT_CONFIG_FILE,
- CUSTOM_CONFIG_FILE,
- UUID_FILE,
- CERTS_DIR)
-from . import eventtypes
+sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+
+from gfevents.eventsapiconf import (LOG_FILE,
+ WEBHOOKS_FILE,
+ DEFAULT_CONFIG_FILE,
+ CUSTOM_CONFIG_FILE,
+ UUID_FILE,
+ CERTS_DIR)
+from gfevents import eventtypes
# Webhooks list
@@ -387,7 +390,7 @@ class PidFile(object):
def webhook_monitor(proc_queue, webhooks):
queues = {}
for url, data in webhooks.items():
- if isinstance(data, str) or isinstance(data, unicode):
+ if isinstance(data, str):
token = data
secret = None
else: