Blob Blame History Raw
From 6ed227367b6eb7d6d7afde3859ad0a711a3adf36 Mon Sep 17 00:00:00 2001
From: Leela Venkaiah G <gleelavenkaiah@gmail.com>
Date: Wed, 13 Jan 2021 16:02:25 +0530
Subject: [PATCH 519/526] glusterfs-events: Fix incorrect attribute access
 (#2002)

Issue: When GlusterCmdException is raised, current code try to access
message atrribute which doesn't exist and resulting in a malformed
error string on failure operations

Code Change: Replace `message` with `args[0]`

>Fixes: #2001
>Change-Id: I65c9f0ee79310937a384025b8d454acda154e4bb
>Signed-off-by: Leela Venkaiah G <lgangava@redhat.com>
Upstream patch: https://github.com/gluster/glusterfs/pull/2002

BUG: 1600459
Change-Id: I65c9f0ee79310937a384025b8d454acda154e4bb
Signed-off-by: srijan-sivakumar <ssivakum@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/223584
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
---
 events/src/peer_eventsapi.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/events/src/peer_eventsapi.py b/events/src/peer_eventsapi.py
index 26b77a0..c388da4 100644
--- a/events/src/peer_eventsapi.py
+++ b/events/src/peer_eventsapi.py
@@ -174,9 +174,9 @@ def sync_to_peers(args):
             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]
+            errmsg = e.args[0][2] if e.args[0][2] else e.args[0][1]
             handle_output_error("Failed to sync Webhooks file: [Error: {0}]"
-                                "{1}".format(e.message[0], errmsg),
+                                "{1}".format(e.args[0][0], errmsg),
                                 errcode=ERROR_WEBHOOK_SYNC_FAILED,
                                 json_output=args.json)
 
@@ -185,9 +185,9 @@ def sync_to_peers(args):
             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]
+            errmsg = e.args[0][2] if e.args[0][2] else e.args[0][1]
             handle_output_error("Failed to sync Config file: [Error: {0}]"
-                                "{1}".format(e.message[0], errmsg),
+                                "{1}".format(e.args[0][0], errmsg),
                                 errcode=ERROR_CONFIG_SYNC_FAILED,
                                 json_output=args.json)
 
-- 
1.8.3.1