17b94a
From b1d8a5ee8b2e320aaaf9b2a145fbc285178d07bb Mon Sep 17 00:00:00 2001
17b94a
From: hari gowtham <hgowtham@redhat.com>
17b94a
Date: Tue, 22 Oct 2019 15:11:03 +0530
17b94a
Subject: [PATCH 312/313] Scripts: quota_fsck script KeyError: 'contri_size'
17b94a
17b94a
    back-port of: https://review.gluster.org/#/c/glusterfs/+/23586/
17b94a
17b94a
Problem: In a certain code flow, we weren't handling the
17b94a
unavailability of the contri value in the dict. Trying to print
17b94a
without the value resulted in erroring out.
17b94a
17b94a
Fix: Have printed the whole of dictionary as the values will be
17b94a
helpful in understanding the state of the file/dir
17b94a
17b94a
>Fixes: bz#1764129
17b94a
>Change-Id: I99c538adb712f281ca10e4e0088f404f515b9725
17b94a
>Signed-off-by: hari gowtham <hgowtham@redhat.com>
17b94a
17b94a
BUG: 1719171
17b94a
Change-Id: I99c538adb712f281ca10e4e0088f404f515b9725
17b94a
Signed-off-by: hari gowtham <hgowtham@redhat.com>
17b94a
Reviewed-on: https://code.engineering.redhat.com/gerrit/183720
17b94a
Tested-by: RHGS Build Bot <nigelb@redhat.com>
17b94a
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
17b94a
---
17b94a
 extras/quota/quota_fsck.py | 12 ++++++------
17b94a
 1 file changed, 6 insertions(+), 6 deletions(-)
17b94a
17b94a
diff --git a/extras/quota/quota_fsck.py b/extras/quota/quota_fsck.py
17b94a
index f03895d..485a37a 100755
17b94a
--- a/extras/quota/quota_fsck.py
17b94a
+++ b/extras/quota/quota_fsck.py
17b94a
@@ -52,17 +52,17 @@ epilog_msg='''
17b94a
 
17b94a
 def print_msg(log_type, path, xattr_dict = {}, stbuf = "", dir_size = None):
17b94a
     if log_type == QUOTA_VERBOSE:
17b94a
-        print('%-24s %-60s\nxattr_values: %s\n%s\n' % {"Verbose", path,  xattr_dict, stbuf})
17b94a
+        print('%-24s %-60s\nxattr_values: %s\n%s\n' % ("Verbose", path, xattr_dict, stbuf))
17b94a
     elif log_type == QUOTA_META_ABSENT:
17b94a
-        print('%-24s %-60s\n%s\n' % {"Quota-Meta Absent", path, xattr_dict})
17b94a
+        print('%-24s %-60s\n%s\n' % ("Quota-Meta Absent", path, xattr_dict))
17b94a
     elif log_type == QUOTA_SIZE_MISMATCH:
17b94a
         print("mismatch")
17b94a
         if dir_size is not None:
17b94a
-            print('%24s %60s %12s %12s' % {"Size Mismatch", path, xattr_dict['contri_size'],
17b94a
-                   dir_size})
17b94a
+            print('%24s %60s %12s %12s' % ("Size Mismatch", path, 
17b94a
+                xattr_dict, dir_size))
17b94a
         else:
17b94a
-            print('%-24s %-60s %-12i %-12i' % {"Size Mismatch", path, xattr_dict['contri_size'],
17b94a
-                   stbuf.st_size})
17b94a
+            print('%-24s %-60s %-12i %-12i' % ("Size Mismatch", path, xattr_dict,
17b94a
+                   stbuf.st_size))
17b94a
 
17b94a
 def size_differs_lot(s1, s2):
17b94a
     '''
17b94a
-- 
17b94a
1.8.3.1
17b94a