Bug 1374587 - gf_event python fails with ImportError
Summary: gf_event python fails with ImportError
Alias: None
Product: GlusterFS
Classification: Community
Component: eventsapi
Version: mainline
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Aravinda VK
QA Contact:
Depends On:
Blocks: 1351589 1375537
TreeView+ depends on / blocked
Reported: 2016-09-09 07:17 UTC by Aravinda VK
Modified: 2017-03-06 17:25 UTC (History)
1 user (show)

Fixed In Version: glusterfs-3.10.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1375537 (view as bug list)
Last Closed: 2017-03-06 17:25:17 UTC
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:

Attachments (Terms of Use)

Description Aravinda VK 2016-09-09 07:17:55 UTC
Description of problem:

Calling gf_event causes import error for python-requests library. 

ImportError: No module named requests

As a workaround, we can install python-requests but this library not required if we are not using Events feature.

Traceback (most recent call last):
  File "/usr/local/libexec/glusterfs/python/syncdaemon/syncdutils.py", line 313, in twrap
  File "/usr/local/libexec/glusterfs/python/syncdaemon/monitor.py", line 403, in wmon
    slave_host, master)
  File "/usr/local/libexec/glusterfs/python/syncdaemon/monitor.py", line 384, in monitor
  File "/usr/local/libexec/glusterfs/python/syncdaemon/syncdutils.py", line 519, in gf_event
    from events.gf_event import gf_event as gfevent
  File "/usr/local/libexec/glusterfs/events/gf_event.py", line 19, in <module>
    from utils import logger, setup_logger, get_config
  File "/usr/local/libexec/glusterfs/events/utils.py", line 16, in <module>
    import requests
ImportError: No module named requests

Comment 1 Worker Ant 2016-09-09 07:19:09 UTC
REVIEW: http://review.gluster.org/15439 (eventsapi: Add conditional import for requests library) posted (#1) for review on master by Aravinda VK (avishwan@redhat.com)

Comment 2 Worker Ant 2016-09-09 12:59:54 UTC
COMMIT: http://review.gluster.org/15439 committed in master by Aravinda VK (avishwan@redhat.com) 
commit aa742fd88e08eeb807dba1cb98402e8813ec6797
Author: Aravinda VK <avishwan@redhat.com>
Date:   Fri Sep 9 12:40:38 2016 +0530

    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 <avishwan@redhat.com>
    Reviewed-on: http://review.gluster.org/15439
    Reviewed-by: Prashanth Pai <ppai@redhat.com>
    Smoke: Gluster Build System <jenkins@build.gluster.org>
    NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
    Reviewed-by: Kotresh HR <khiremat@redhat.com>
    CentOS-regression: Gluster Build System <jenkins@build.gluster.org>

Comment 3 Shyamsundar 2017-03-06 17:25:17 UTC
This bug is getting closed because a release has been made available that should address the reported issue. In case the problem is still not fixed with glusterfs-3.10.0, please open a new bug report.

glusterfs-3.10.0 has been announced on the Gluster mailinglists [1], packages for several distributions should become available in the near future. Keep an eye on the Gluster Users mailinglist [2] and the update infrastructure for your distribution.

[1] http://lists.gluster.org/pipermail/gluster-users/2017-February/030119.html
[2] https://www.gluster.org/pipermail/gluster-users/

Note You need to log in before you can comment on or make changes to this bug.