summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAravinda VK <avishwan@redhat.com>2019-03-04 13:39:18 +0530
committerShyamsundar Ranganathan <srangana@redhat.com>2019-03-15 12:45:45 +0000
commitc2a48920015f7b2d5516858d2ed4bb05e0e6f9d9 (patch)
treef14a255c97f16e780d741cbc3eabe969ebd5e7b8
parenta086c6473875ab94a4a08baf454eac567f575b06 (diff)
eventsapi: Fix error while handling GlusterCmdException
`GlusterCmdException` was wrongly accessed instead of accessing `GlusterCmdException.message`. Fixes: bz#1687249 Change-Id: I35ec1b05726050bfd8761e05ad9b9e47917dc0c6 Signed-off-by: Aravinda VK <avishwan@redhat.com> (cherry picked from commit 27f6375df009c8c4798b72aeafce79456007d21f)
-rw-r--r--events/src/peer_eventsapi.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/events/src/peer_eventsapi.py b/events/src/peer_eventsapi.py
index e8bd4bd31af..26b77a09179 100644
--- a/events/src/peer_eventsapi.py
+++ b/events/src/peer_eventsapi.py
@@ -173,8 +173,10 @@ def sync_to_peers(args):
try:
sync_file_to_peers(WEBHOOKS_FILE_TO_SYNC)
except GlusterCmdException as e:
+ # Print stdout if stderr is empty
+ errmsg = e.message[2] if e.message[2] else e.message[1]
handle_output_error("Failed to sync Webhooks file: [Error: {0}]"
- "{1}".format(e[0], e[2]),
+ "{1}".format(e.message[0], errmsg),
errcode=ERROR_WEBHOOK_SYNC_FAILED,
json_output=args.json)
@@ -182,8 +184,10 @@ def sync_to_peers(args):
try:
sync_file_to_peers(CUSTOM_CONFIG_FILE_TO_SYNC)
except GlusterCmdException as e:
+ # Print stdout if stderr is empty
+ errmsg = e.message[2] if e.message[2] else e.message[1]
handle_output_error("Failed to sync Config file: [Error: {0}]"
- "{1}".format(e[0], e[2]),
+ "{1}".format(e.message[0], errmsg),
errcode=ERROR_CONFIG_SYNC_FAILED,
json_output=args.json)