summaryrefslogtreecommitdiffstats
path: root/events
diff options
context:
space:
mode:
authorAravinda VK <[email protected]>2016-09-09 12:40:38 +0530
committerAravinda VK <[email protected]>2016-09-09 05:59:50 -0700
commitaa742fd88e08eeb807dba1cb98402e8813ec6797 (patch)
tree737b3c90163ee6337d11ebc39af8f1ddf1632660 /events
parent36af81ac7cb2d459f9bfc0c436f0038a68f85235 (diff)
downloadglusterfs-aa742fd88e08eeb807dba1cb98402e8813ec6797.tar.gz
glusterfs-aa742fd88e08eeb807dba1cb98402e8813ec6797.tar.xz
glusterfs-aa742fd88e08eeb807dba1cb98402e8813ec6797.zip
eventsapi: Add conditional import for requests library
requests lib is used only during publishing event. gf_event python imports utils.py, and indirectly imports requests lib even though it is not required while sending event to eventsd. Moved "import requests" inside the "plugin_webhook" function. BUG: 1374587 Change-Id: Ie3c8088b43d4d7952d01352731999bf8519c73c4 Signed-off-by: Aravinda VK <[email protected]> Reviewed-on: http://review.gluster.org/15439 Reviewed-by: Prashanth Pai <[email protected]> Smoke: Gluster Build System <[email protected]> NetBSD-regression: NetBSD Build System <[email protected]> Reviewed-by: Kotresh HR <[email protected]> CentOS-regression: Gluster Build System <[email protected]>
Diffstat (limited to 'events')
-rw-r--r--events/src/utils.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/events/src/utils.py b/events/src/utils.py
index db8ebfe29a..dadd9ae333 100644
--- a/events/src/utils.py
+++ b/events/src/utils.py
@@ -15,7 +15,6 @@ import logging
import fcntl
from errno import ESRCH, EBADF
-import requests
from eventsapiconf import (LOG_FILE,
WEBHOOKS_FILE,
DEFAULT_CONFIG_FILE,
@@ -145,6 +144,9 @@ def publish(ts, event_key, data):
def plugin_webhook(message):
+ # Import requests here since not used in any other place
+ import requests
+
message_json = json.dumps(message, sort_keys=True)
logger.debug("EVENT: {0}".format(message_json))
for url, token in _webhooks.items():
OSZAR »