From a9b5333d7bae6e20ffef07dffcda49eaf9d6823b Mon Sep 17 00:00:00 2001 From: Aravinda VK Date: Thu, 13 Apr 2017 12:56:09 +0530 Subject: 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 Reviewed-on: https://review.gluster.org/17054 Smoke: Gluster Build System Reviewed-by: Prashanth Pai CentOS-regression: Gluster Build System NetBSD-regression: NetBSD Build System --- events/src/peer_eventsapi.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'events') 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)) -- cgit