From 6694d72c786b754d76bc18854174accfb2c23efa Mon Sep 17 00:00:00 2001 From: kshithijiyer Date: Fri, 14 Aug 2020 12:44:48 +0530 Subject: [Libfix] Fix python3 getfattr() issues Problem: Due to patch [1] which was sent for issue #24 causes a large number of testcases to fail or get stuck in the latest DHT run. Solution: Make changes sot that getfattr command sends back the output in text wherever needed. Links: [1] https://review.gluster.org/#/c/glusto-tests/+/24841/ Change-Id: I6390e38130b0699ceae652dee8c3b2db2ef3f379 Signed-off-by: kshithijiyer --- glustolibs-gluster/glustolibs/gluster/glusterfile.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'glustolibs-gluster/glustolibs/gluster') diff --git a/glustolibs-gluster/glustolibs/gluster/glusterfile.py b/glustolibs-gluster/glustolibs/gluster/glusterfile.py index 86383e800..227ef6f8d 100755 --- a/glustolibs-gluster/glustolibs/gluster/glusterfile.py +++ b/glustolibs-gluster/glustolibs/gluster/glusterfile.py @@ -116,7 +116,7 @@ def get_fattr(host, fqpath, fattr, encode="hex"): (encode, fattr, fqpath)) rcode, rout, rerr = g.run(host, command) if not rcode: - return rout.strip().split('=')[1] + return rout.strip().split('=')[1].replace('"', '') g.log.error('getfattr failed: %s' % rerr) return None @@ -400,7 +400,8 @@ def get_pathinfo(host, fqpath): A dictionary of pathinfo data for a remote file. None on fail. """ pathinfo = {} - pathinfo['raw'] = get_fattr(host, fqpath, 'trusted.glusterfs.pathinfo') + pathinfo['raw'] = get_fattr(host, fqpath, 'trusted.glusterfs.pathinfo', + encode="text") pathinfo['brickdir_paths'] = re.findall(r".*?POSIX.*?:(\S+)\>", pathinfo['raw']) @@ -444,7 +445,8 @@ def get_dht_linkto_xattr(host, fqpath): Returns: Return value of get_fattr trusted.glusterfs.dht.linkto call. """ - linkto_xattr = get_fattr(host, fqpath, 'trusted.glusterfs.dht.linkto') + linkto_xattr = get_fattr(host, fqpath, 'trusted.glusterfs.dht.linkto', + encode="text") return linkto_xattr -- cgit