summaryrefslogtreecommitdiffstats
path: root/glustolibs-gluster/glustolibs/gluster
diff options
context:
space:
mode:
authorkshithijiyer <kshithij.ki@gmail.com>2020-08-06 21:47:41 +0530
committerkshithijiyer <kshithij.ki@gmail.com>2020-08-06 22:15:06 +0530
commit40f5b8754c854c07c38ee501c00a399df1ca1323 (patch)
treec4e6f390f879d5f6a192acb5a741f028101d7b07 /glustolibs-gluster/glustolibs/gluster
parent0b86bc1caa81ca558606d0e68fdf36f3eb5d4a59 (diff)
[Testfix] Add logic to log more info
Adding code to get dir tree and dump all xattr in hex for Bug 1810901 before remove-brick also adding logic to set log-level to debug. Change-Id: I9c9c970c4de7d313832f6f189cdca8428a073b1e Signed-off-by: kshithijiyer <kshithij.ki@gmail.com>
Diffstat (limited to 'glustolibs-gluster/glustolibs/gluster')
-rwxr-xr-xglustolibs-gluster/glustolibs/gluster/glusterfile.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/glustolibs-gluster/glustolibs/gluster/glusterfile.py b/glustolibs-gluster/glustolibs/gluster/glusterfile.py
index 70777c67c..7cb961c03 100755
--- a/glustolibs-gluster/glustolibs/gluster/glusterfile.py
+++ b/glustolibs-gluster/glustolibs/gluster/glusterfile.py
@@ -119,18 +119,25 @@ def get_fattr(host, fqpath, fattr):
return None
-def get_fattr_list(host, fqpath):
+def get_fattr_list(host, fqpath, encode_hex=False):
"""List of xattr for filepath on remote system.
Args:
host (str): The hostname/ip of the remote system.
fqpath (str): The fully-qualified path to the file.
+ Kwargs:
+ encode_hex(bool): Fetch xattr in hex if True
+ (Default:False)
+
Returns:
Dictionary of xattrs on success. None on fail.
"""
- command = "getfattr --absolute-names -d -m - %s" % fqpath
- rcode, rout, rerr = g.run(host, command)
+ cmd = "getfattr --absolute-names -d -m - {}".format(fqpath)
+ if encode_hex:
+ cmd = ("getfattr --absolute-names -d -m - -e hex {}"
+ .format(fqpath))
+ rcode, rout, rerr = g.run(host, cmd)
if rcode == 0:
xattr_list = {}