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