summaryrefslogtreecommitdiffstats
path: root/events/src/utils.py
diff options
context:
space:
mode:
authorAravinda VK <avishwan@redhat.com>2019-02-21 11:25:55 +0530
committerAravinda VK <avishwan@redhat.com>2019-02-26 05:11:49 +0000
commite54a8ee281010106e46f67f80494da8cf80908e5 (patch)
tree2d210e39f5d4bddcd58e3fb12f75c75982fb8939 /events/src/utils.py
parent15403f96941caab4a4aa96630e47a9e831d32302 (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#1649054 Change-Id: I3dc38bc92b23387a6dfbcc0ab8283178235bf756 Signed-off-by: Aravinda VK <avishwan@redhat.com> (cherry picked from commit cd68f7b88b9a2c9a4e4ff9fca61517384e54130a)
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: