Bug 1441945 - [Eventing]: Unrelated error message displayed when path specified during a 'webhook-test/add' is missing a schema
Summary: [Eventing]: Unrelated error message displayed when path specified during a 'w...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: GlusterFS
Classification: Community
Component: eventsapi
Version: mainline
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
Assignee: Aravinda VK
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: 1441942 1443349
TreeView+ depends on / blocked
 
Reported: 2017-04-13 07:25 UTC by Aravinda VK
Modified: 2017-05-30 18:49 UTC (History)
3 users (show)

Fixed In Version: glusterfs-3.11.0
Clone Of: 1441942
: 1443349 (view as bug list)
Environment:
Last Closed: 2017-05-30 18:49:52 UTC
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Embargoed:


Attachments (Terms of Use)

Description Aravinda VK 2017-04-13 07:25:28 UTC
+++ This bug was initially created as a clone of Bug #1441942 +++

Description of problem:
=======================
On a gluster cluster with eventing enabled, the correct command to register a webhook would be:
    gluster-eventsapi webhook-test http://<ip>:<port_number><path_specified_in_webhook>

Say, we miss giving 'http', or 'tcp' or any such protocol in the path, then an exception is thrown by one of the internal scripts (/usr/libexec/glusterfs/peer_eventsapi.py):
    requests.exceptions.InvalidSchema: No connection adapters were found for '10.70.35.21:9000/listen'

This error message is expected to be caught and displayed by the gluster-eventsapi command, but instead it prints out:
    gluster.cliutils.cliutils.GlusterCmdException: (1, '', 'Unable to end. Error : Success\n', 'gluster system:: execute eventsapi.py node-webhook-test 10.70.35.21:9000/listen .

The above message is misleading and does not give an idea as to what is wrong. The correct error message if displayed would guide the user to take the appropriate corrective action.

Version-Release number of selected component (if applicable):
============================================================
3.8.4-22


How reproducible:
=================
2:2


Additional info:
================



[root@dhcp47-165 ~]# gluster-eventsapi webhook-test 10.70.35.21:9000/listen
Traceback (most recent call last):
  File "/usr/sbin/gluster-eventsapi", line 602, in <module>
    runcli()
  File "/usr/lib/python2.7/site-packages/gluster/cliutils/cliutils.py", line 224, in runcli
    cls.run(args)
  File "/usr/sbin/gluster-eventsapi", line 411, in run
    out = execute_in_peers("node-webhook-test", [url, bearer_token])
  File "/usr/lib/python2.7/site-packages/gluster/cliutils/cliutils.py", line 126, in execute_in_peers
    raise GlusterCmdException((rc, out, err, " ".join(cmd)))
gluster.cliutils.cliutils.GlusterCmdException: (1, '', 'Unable to end. Error : Success\n', 'gluster system:: execute eventsapi.py node-webhook-test 10.70.35.21:9000/listen .')
[root@dhcp47-165 ~]# python /usr/libexec/glusterfs/peer_eventsapi.py node-webhook-test 10.70.35.21:9000/listen
usage: peer_eventsapi.py node-webhook-test [-h] [--json] url bearer_token
peer_eventsapi.py node-webhook-test: error: too few arguments
[root@dhcp47-165 ~]# python /usr/libexec/glusterfs/peer_eventsapi.py node-webhook-test 10.70.35.21:9000/listen .
Traceback (most recent call last):
  File "/usr/libexec/glusterfs/peer_eventsapi.py", line 602, in <module>
    runcli()
  File "/usr/lib/python2.7/site-packages/gluster/cliutils/cliutils.py", line 224, in runcli
    cls.run(args)
  File "/usr/libexec/glusterfs/peer_eventsapi.py", line 386, in run
    resp = requests.post(args.url, headers=http_headers)
  File "/usr/lib/python2.7/site-packages/requests/api.py", line 109, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/usr/lib/python2.7/site-packages/requests/api.py", line 50, in request
    response = session.request(method=method, url=url, **kwargs)
  File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 465, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 567, in send
    adapter = self.get_adapter(url=request.url)
  File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 641, in get_adapter
    raise InvalidSchema("No connection adapters were found for '%s'" % url)
requests.exceptions.InvalidSchema: No connection adapters were found for '10.70.35.21:9000/listen'
[root@dhcp47-165 ~]#
[root@dhcp47-165 ~]# python /usr/libexec/glusterfs/peer_eventsapi.py node-webhook-test http://10.70.35.21:9000/listen .
{"output": "", "ok": true, "nodeid": "834d66eb-fb65-4ea3-949a-e7cb4c198f2b"}
[root@dhcp47-165 ~]# ^C
[root@dhcp47-165 ~]# 
[root@dhcp47-165 ~]# python /usr/libexec/glusterfs/peer_eventsapi.py node-webhook-test http://10.70.35.21:9000/listen .
{"output": "", "ok": true, "nodeid": "834d66eb-fb65-4ea3-949a-e7cb4c198f2b"}
[root@dhcp47-165 ~]# gluster-eventsapi webhook-test http://10.70.35.21:9000/listen+-----------------------------------+-------------+----------------+
|                NODE               | NODE STATUS | WEBHOOK STATUS |
+-----------------------------------+-------------+----------------+
| dhcp47-164.lab.eng.blr.redhat.com |          UP |             OK |
| dhcp47-162.lab.eng.blr.redhat.com |          UP |             OK |
| dhcp47-157.lab.eng.blr.redhat.com |          UP |             OK |
|             localhost             |          UP |             OK |
+-----------------------------------+-------------+----------------+
[root@dhcp47-165 ~]#

[root@dhcp47-165 ~]# 
[root@dhcp47-165 ~]# gluster peer status
Number of Peers: 3

Hostname: dhcp47-164.lab.eng.blr.redhat.com
Uuid: afa697a0-2cc6-4705-892e-f5ec56a9f9de
State: Peer in Cluster (Connected)

Hostname: dhcp47-162.lab.eng.blr.redhat.com
Uuid: 95491d39-d83a-4053-b1d5-682ca7290bd2
State: Peer in Cluster (Connected)

Hostname: dhcp47-157.lab.eng.blr.redhat.com
Uuid: d0955c85-94d0-41ba-aea8-1ffde3575ea5
State: Peer in Cluster (Connected)
[root@dhcp47-165 ~]# gluster v list
disp
dist
ozone

Comment 1 Worker Ant 2017-04-13 07:45:04 UTC
REVIEW: https://review.gluster.org/17054 (eventsapi: Fix webhook-test when no schema specified in URL) posted (#1) for review on master by Aravinda VK (avishwan)

Comment 2 Worker Ant 2017-04-13 13:55:06 UTC
REVIEW: https://review.gluster.org/17054 (eventsapi: Fix webhook-test when no schema specified in URL) posted (#2) for review on master by Atin Mukherjee (amukherj)

Comment 3 Worker Ant 2017-04-17 10:25:30 UTC
COMMIT: https://review.gluster.org/17054 committed in master by Aravinda VK (avishwan) 
------
commit a9b5333d7bae6e20ffef07dffcda49eaf9d6823b
Author: Aravinda VK <avishwan>
Date:   Thu Apr 13 12:56:09 2017 +0530

    eventsapi: Fix webhook-test when no schema specified in URL
    
    If no schema specifed like `http` or `https` while testing webhook,
    it was failing with Schema Exception and not communicated the error
    to CLI caller.
    
    With this patch exception is handled and responded back to CLI caller.
    
    BUG: 1441945
    Change-Id: I9be11d36e9f65be873516fef370c327f1cdbc93e
    Signed-off-by: Aravinda VK <avishwan>
    Reviewed-on: https://review.gluster.org/17054
    Smoke: Gluster Build System <jenkins.org>
    Reviewed-by: Prashanth Pai <ppai>
    CentOS-regression: Gluster Build System <jenkins.org>
    NetBSD-regression: NetBSD Build System <jenkins.org>

Comment 4 Shyamsundar 2017-05-30 18:49:52 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.11.0, please open a new bug report.

glusterfs-3.11.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/announce/2017-May/000073.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.