diff options
author | Aravinda VK <avishwan@redhat.com> | 2019-03-04 13:39:18 +0530 |
---|---|---|
committer | Amar Tumballi <amarts@redhat.com> | 2019-03-06 13:22:18 +0000 |
commit | 27f6375df009c8c4798b72aeafce79456007d21f (patch) | |
tree | 36ac1db68be2c59177b5074f8ee671ff1e5ed6aa /events/src | |
parent | 6b99558be6872bb5ba5fe8133696ca856617b184 (diff) |
eventsapi: Fix error while handling GlusterCmdException
`GlusterCmdException` was wrongly accessed instead of accessing
`GlusterCmdException.message`.
Fixes: bz#1685027
Change-Id: I35ec1b05726050bfd8761e05ad9b9e47917dc0c6
Signed-off-by: Aravinda VK <avishwan@redhat.com>
Diffstat (limited to 'events/src')
-rw-r--r-- | events/src/peer_eventsapi.py | 8 |
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) |