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