summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAravinda VK <avishwan@redhat.com>2017-04-13 12:56:09 +0530
committerRaghavendra Talur <rtalur@redhat.com>2017-05-02 11:31:23 +0000
commite075b60ccf30265f8731e4ff3a476ebb1277ba24 (patch)
treecebe93f1c858cd2a2bcf42689dd634ec99d354bd
parenta00ebebdb68bfe97cca263d0327889abf37b3d19 (diff)
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@build.gluster.org> > Reviewed-by: Prashanth Pai <ppai@redhat.com> > CentOS-regression: Gluster Build System <jenkins@build.gluster.org> > NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> (cherry picked from commit a9b5333d7bae6e20ffef07dffcda49eaf9d6823b) BUG: 1443349 Signed-off-by: Aravinda VK <avishwan@redhat.com> Change-Id: I9be11d36e9f65be873516fef370c327f1cdbc93e Change-Id: Ied16e156e9b6a96a416b689f8b3a67e976f5b3de Reviewed-on: https://review.gluster.org/17079 NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Prashanth Pai <ppai@redhat.com>
-rw-r--r--events/src/peer_eventsapi.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/events/src/peer_eventsapi.py b/events/src/peer_eventsapi.py
index 6cba277bf70..59808ada539 100644
--- a/events/src/peer_eventsapi.py
+++ b/events/src/peer_eventsapi.py
@@ -161,7 +161,7 @@ def rows_to_table(table, rows):
num_ok_rows += 1 if row.ok else 0
table.add_row([row.hostname,
"UP" if row.node_up else "DOWN",
- "OK" if row.ok else "NOT OK: {1}".format(
+ "OK" if row.ok else "NOT OK: {0}".format(
row.error)])
return num_ok_rows
@@ -386,6 +386,8 @@ class NodeWebhookTestCmd(Cmd):
resp = requests.post(args.url, headers=http_headers)
except requests.ConnectionError as e:
node_output_notok("{0}".format(e))
+ except requests.exceptions.InvalidSchema as e:
+ node_output_notok("{0}".format(e))
if resp.status_code != 200:
node_output_notok("{0}".format(resp.status_code))