Bug 1443349 - [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: 3.10
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
Assignee: Aravinda VK
QA Contact:
URL:
Whiteboard:
Depends On: 1441945
Blocks: 1441942 glusterfs-3.10.2
TreeView+ depends on / blocked
 
Reported: 2017-04-19 06:47 UTC by Aravinda VK
Modified: 2017-05-31 20:44 UTC (History)
4 users (show)

Fixed In Version: glusterfs-3.10.2
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1441945
Environment:
Last Closed: 2017-05-31 20:44:48 UTC
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Embargoed:


Attachments (Terms of Use)

Description Aravinda VK 2017-04-19 06:47:10 UTC
+++ This bug was initially created as a clone of Bug #1441945 +++

+++ 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

--- Additional comment from Worker Ant on 2017-04-13 03:45:04 EDT ---

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)

--- Additional comment from Worker Ant on 2017-04-13 09:55:06 EDT ---

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)

--- Additional comment from Worker Ant on 2017-04-17 06:25:30 EDT ---

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 1 Worker Ant 2017-04-19 06:48:31 UTC
REVIEW: https://review.gluster.org/17079 (eventsapi: Fix webhook-test when no schema specified in URL) posted (#1) for review on release-3.10 by Aravinda VK (avishwan)

Comment 2 Worker Ant 2017-04-19 06:51:28 UTC
REVIEW: https://review.gluster.org/17079 (eventsapi: Fix webhook-test when no schema specified in URL) posted (#2) for review on release-3.10 by Aravinda VK (avishwan)

Comment 3 Worker Ant 2017-05-02 11:31:26 UTC
COMMIT: https://review.gluster.org/17079 committed in release-3.10 by Raghavendra Talur (rtalur) 
------
commit e075b60ccf30265f8731e4ff3a476ebb1277ba24
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.
    
    > 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>
    (cherry picked from commit a9b5333d7bae6e20ffef07dffcda49eaf9d6823b)
    
    BUG: 1443349
    Signed-off-by: Aravinda VK <avishwan>
    Change-Id: I9be11d36e9f65be873516fef370c327f1cdbc93e
    Change-Id: Ied16e156e9b6a96a416b689f8b3a67e976f5b3de
    Reviewed-on: https://review.gluster.org/17079
    NetBSD-regression: NetBSD Build System <jenkins.org>
    CentOS-regression: Gluster Build System <jenkins.org>
    Smoke: Gluster Build System <jenkins.org>
    Reviewed-by: Prashanth Pai <ppai>

Comment 4 Raghavendra Talur 2017-05-31 20:44:48 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.2, please open a new bug report.


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