Bug 1441942 - [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 ERRATA
Alias: None
Product: Red Hat Gluster Storage
Classification: Red Hat Storage
Component: eventsapi
Version: rhgs-3.3
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
: RHGS 3.3.0
Assignee: Aravinda VK
QA Contact: Sweta Anandpara
URL:
Whiteboard:
Depends On: 1441945 1443349
Blocks: 1417151
TreeView+ depends on / blocked
 
Reported: 2017-04-13 07:07 UTC by Sweta Anandpara
Modified: 2017-09-21 04:37 UTC (History)
5 users (show)

Fixed In Version: glusterfs-3.8.4-23
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1441945 (view as bug list)
Environment:
Last Closed: 2017-09-21 04:37:54 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2017:2774 0 normal SHIPPED_LIVE glusterfs bug fix and enhancement update 2017-09-21 08:16:29 UTC

Description Sweta Anandpara 2017-04-13 07:07:57 UTC
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
[root@dhcp47-165 ~]# 
[root@dhcp47-165 ~]# rpm -qa | grep gluster
glusterfs-libs-3.8.4-22.el7rhgs.x86_64
glusterfs-cli-3.8.4-22.el7rhgs.x86_64
glusterfs-client-xlators-3.8.4-22.el7rhgs.x86_64
glusterfs-rdma-3.8.4-22.el7rhgs.x86_64
vdsm-gluster-4.17.33-1.1.el7rhgs.noarch
glusterfs-3.8.4-22.el7rhgs.x86_64
glusterfs-api-3.8.4-22.el7rhgs.x86_64
glusterfs-events-3.8.4-22.el7rhgs.x86_64
gluster-nagios-common-0.2.4-1.el7rhgs.noarch
gluster-nagios-addons-0.2.8-1.el7rhgs.x86_64
glusterfs-fuse-3.8.4-22.el7rhgs.x86_64
glusterfs-geo-replication-3.8.4-22.el7rhgs.x86_64
glusterfs-server-3.8.4-22.el7rhgs.x86_64
python-gluster-3.8.4-22.el7rhgs.noarch
[root@dhcp47-165 ~]# 
[root@dhcp47-165 ~]#

Comment 2 Aravinda VK 2017-04-13 08:25:04 UTC
Upstream patch sent
https://review.gluster.org/17054

Comment 5 Aravinda VK 2017-04-19 07:10:57 UTC
Downstream patch: https://code.engineering.redhat.com/gerrit/#/c/103716
Upstream 3.10 patch: https://review.gluster.org/17079

Comment 7 Sweta Anandpara 2017-05-04 10:36:55 UTC
Verifying this on the build 3.8.4-23. 

I am able to see the below error, mentioning connection adapters. Aravinda, is this the expected error that is to be seen? I was assuming to see something related to 'invalid schema'. 

[root@dhcp47-121 ~]# gluster-eventsapi webhook-test 10.70.35.119:9001/listen
+-----------------------------------+-------------+--------------------------------------------------------------------------+
|                NODE               | NODE STATUS |                                                           WEBHOOK STATUS |
+-----------------------------------+-------------+--------------------------------------------------------------------------+
| dhcp47-113.lab.eng.blr.redhat.com |          UP | NOT OK: No connection adapters were found for '10.70.35.119:9001/listen' |
| dhcp47-114.lab.eng.blr.redhat.com |          UP | NOT OK: No connection adapters were found for '10.70.35.119:9001/listen' |
| dhcp47-115.lab.eng.blr.redhat.com |          UP | NOT OK: No connection adapters were found for '10.70.35.119:9001/listen' |
| dhcp47-116.lab.eng.blr.redhat.com |          UP | NOT OK: No connection adapters were found for '10.70.35.119:9001/listen' |
| dhcp47-117.lab.eng.blr.redhat.com |          UP | NOT OK: No connection adapters were found for '10.70.35.119:9001/listen' |
|             localhost             |          UP | NOT OK: No connection adapters were found for '10.70.35.119:9001/listen' |
+-----------------------------------+-------------+--------------------------------------------------------------------------+
[root@dhcp47-121 ~]#

Comment 8 Sweta Anandpara 2017-05-04 10:39:31 UTC
Also, the above error that is seen is only for 'webhook-test'. I do not see the same error when I try webhook-add directly. Webhook-add completes successfully!

Is there a default protocol that is taken, if not explicitly specified.
If yes, shouldn't it be considered for 'webhook-test' as well?

[root@dhcp47-121 ~]# gluster-eventsapi webhook-test 10.70.35.119:9001/listen
+-----------------------------------+-------------+--------------------------------------------------------------------------+
|                NODE               | NODE STATUS |                                                           WEBHOOK STATUS |
+-----------------------------------+-------------+--------------------------------------------------------------------------+
| dhcp47-113.lab.eng.blr.redhat.com |          UP | NOT OK: No connection adapters were found for '10.70.35.119:9001/listen' |
| dhcp47-114.lab.eng.blr.redhat.com |          UP | NOT OK: No connection adapters were found for '10.70.35.119:9001/listen' |
| dhcp47-115.lab.eng.blr.redhat.com |          UP | NOT OK: No connection adapters were found for '10.70.35.119:9001/listen' |
| dhcp47-116.lab.eng.blr.redhat.com |          UP | NOT OK: No connection adapters were found for '10.70.35.119:9001/listen' |
| dhcp47-117.lab.eng.blr.redhat.com |          UP | NOT OK: No connection adapters were found for '10.70.35.119:9001/listen' |
|             localhost             |          UP | NOT OK: No connection adapters were found for '10.70.35.119:9001/listen' |
+-----------------------------------+-------------+--------------------------------------------------------------------------+
[root@dhcp47-121 ~]# gluster-eventsapi webhook-add 10.70.35.119:9001/listen
+-----------------------------------+-------------+-------------+
|                NODE               | NODE STATUS | SYNC STATUS |
+-----------------------------------+-------------+-------------+
| dhcp47-113.lab.eng.blr.redhat.com |          UP |          OK |
| dhcp47-114.lab.eng.blr.redhat.com |          UP |          OK |
| dhcp47-115.lab.eng.blr.redhat.com |          UP |          OK |
| dhcp47-116.lab.eng.blr.redhat.com |          UP |          OK |
| dhcp47-117.lab.eng.blr.redhat.com |          UP |          OK |
|             localhost             |          UP |          OK |
+-----------------------------------+-------------+-------------+
[root@dhcp47-121 ~]# gluster-eventsapi status
Webhooks: 
http://10.70.35.21:9000/listen
10.70.35.119:9001/listen

+-----------------------------------+-------------+-----------------------+
|                NODE               | NODE STATUS | GLUSTEREVENTSD STATUS |
+-----------------------------------+-------------+-----------------------+
| dhcp47-113.lab.eng.blr.redhat.com |          UP |                    OK |
| dhcp47-114.lab.eng.blr.redhat.com |          UP |                    OK |
| dhcp47-115.lab.eng.blr.redhat.com |          UP |                    OK |
| dhcp47-116.lab.eng.blr.redhat.com |          UP |                    OK |
| dhcp47-117.lab.eng.blr.redhat.com |          UP |                    OK |
|             localhost             |          UP |                    OK |
+-----------------------------------+-------------+-----------------------+
[root@dhcp47-121 ~]#

Comment 9 Aravinda VK 2017-05-08 07:21:12 UTC
(In reply to Sweta Anandpara from comment #8)
> Also, the above error that is seen is only for 'webhook-test'. I do not see
> the same error when I try webhook-add directly. Webhook-add completes
> successfully!
> 
> Is there a default protocol that is taken, if not explicitly specified.
> If yes, shouldn't it be considered for 'webhook-test' as well?

No validations added during webhook-add, it registers whatever the url is added. But logs error while pushing messages on any event.

Comment 10 Sweta Anandpara 2017-05-10 08:52:24 UTC
Have raised bz 1449538 to assess the correctness of the url specified in 'gluster-eventsapi webhook-add'

Moving the present BZ to verified in 3.3 with the logs pasted in comment 7 and 8.

Comment 12 errata-xmlrpc 2017-09-21 04:37:54 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:2774


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