74096c
From 6ed227367b6eb7d6d7afde3859ad0a711a3adf36 Mon Sep 17 00:00:00 2001
74096c
From: Leela Venkaiah G <gleelavenkaiah@gmail.com>
74096c
Date: Wed, 13 Jan 2021 16:02:25 +0530
74096c
Subject: [PATCH 519/526] glusterfs-events: Fix incorrect attribute access
74096c
 (#2002)
74096c
74096c
Issue: When GlusterCmdException is raised, current code try to access
74096c
message atrribute which doesn't exist and resulting in a malformed
74096c
error string on failure operations
74096c
74096c
Code Change: Replace `message` with `args[0]`
74096c
74096c
>Fixes: #2001
74096c
>Change-Id: I65c9f0ee79310937a384025b8d454acda154e4bb
74096c
>Signed-off-by: Leela Venkaiah G <lgangava@redhat.com>
74096c
Upstream patch: https://github.com/gluster/glusterfs/pull/2002
74096c
74096c
BUG: 1600459
74096c
Change-Id: I65c9f0ee79310937a384025b8d454acda154e4bb
74096c
Signed-off-by: srijan-sivakumar <ssivakum@redhat.com>
74096c
Reviewed-on: https://code.engineering.redhat.com/gerrit/223584
74096c
Tested-by: RHGS Build Bot <nigelb@redhat.com>
74096c
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
74096c
---
74096c
 events/src/peer_eventsapi.py | 8 ++++----
74096c
 1 file changed, 4 insertions(+), 4 deletions(-)
74096c
74096c
diff --git a/events/src/peer_eventsapi.py b/events/src/peer_eventsapi.py
74096c
index 26b77a0..c388da4 100644
74096c
--- a/events/src/peer_eventsapi.py
74096c
+++ b/events/src/peer_eventsapi.py
74096c
@@ -174,9 +174,9 @@ def sync_to_peers(args):
74096c
             sync_file_to_peers(WEBHOOKS_FILE_TO_SYNC)
74096c
         except GlusterCmdException as e:
74096c
             # Print stdout if stderr is empty
74096c
-            errmsg = e.message[2] if e.message[2] else e.message[1]
74096c
+            errmsg = e.args[0][2] if e.args[0][2] else e.args[0][1]
74096c
             handle_output_error("Failed to sync Webhooks file: [Error: {0}]"
74096c
-                                "{1}".format(e.message[0], errmsg),
74096c
+                                "{1}".format(e.args[0][0], errmsg),
74096c
                                 errcode=ERROR_WEBHOOK_SYNC_FAILED,
74096c
                                 json_output=args.json)
74096c
 
74096c
@@ -185,9 +185,9 @@ def sync_to_peers(args):
74096c
             sync_file_to_peers(CUSTOM_CONFIG_FILE_TO_SYNC)
74096c
         except GlusterCmdException as e:
74096c
             # Print stdout if stderr is empty
74096c
-            errmsg = e.message[2] if e.message[2] else e.message[1]
74096c
+            errmsg = e.args[0][2] if e.args[0][2] else e.args[0][1]
74096c
             handle_output_error("Failed to sync Config file: [Error: {0}]"
74096c
-                                "{1}".format(e.message[0], errmsg),
74096c
+                                "{1}".format(e.args[0][0], errmsg),
74096c
                                 errcode=ERROR_CONFIG_SYNC_FAILED,
74096c
                                 json_output=args.json)
74096c
 
74096c
-- 
74096c
1.8.3.1
74096c