summaryrefslogtreecommitdiffstats
path: root/events/src
diff options
context:
space:
mode:
authorAravinda VK <avishwan@redhat.com>2017-04-13 12:56:09 +0530
committerAravinda VK <avishwan@redhat.com>2017-04-17 06:25:27 -0400
commita9b5333d7bae6e20ffef07dffcda49eaf9d6823b (patch)
treed292c00dba1e3ecac97d9bc2a5a8ed5f6c5a30fe /events/src
parent324509b340ebbab1e1531de9ba0a3ed6f4563753 (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. BUG: 1441945 Change-Id: I9be11d36e9f65be873516fef370c327f1cdbc93e Signed-off-by: Aravinda VK <avishwan@redhat.com> 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>
Diffstat (limited to 'events/src')
-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))