summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPranav <prprakas@redhat.com>2020-06-30 10:45:44 +0530
committerArthy Loganathan <aloganat@redhat.com>2020-06-30 06:03:58 +0000
commit8593d181cd5ab897cd818797e60b9466e68eafd6 (patch)
treed59e08700cb5f80ba3692893b7e57a26a1bc8522
parent02ad1ce75cbf9205b6682dceb151b82939ffd679 (diff)
[Libfix] Fix is_linkto_file() compatible with newer platforms
Problem: The 'file <file_path>' command output differs in newer platforms. An additional ',' is present in latest builds of the packages, causing tests which uses this method to fail on newer platforms. Fix: Modify the method to handle the latest package output as well Change-Id: I3e59a69b09b960e3a38131a3e76d664b34799ab1 Signed-off-by: Pranav <prprakas@redhat.com>
-rwxr-xr-xglustolibs-gluster/glustolibs/gluster/glusterfile.py7
1 files changed, 2 insertions, 5 deletions
diff --git a/glustolibs-gluster/glustolibs/gluster/glusterfile.py b/glustolibs-gluster/glustolibs/gluster/glusterfile.py
index c057400..70777c6 100755
--- a/glustolibs-gluster/glustolibs/gluster/glusterfile.py
+++ b/glustolibs-gluster/glustolibs/gluster/glusterfile.py
@@ -413,17 +413,14 @@ def is_linkto_file(host, fqpath):
"""
command = 'file %s' % fqpath
rcode, rout, _ = g.run(host, command)
-
if rcode == 0:
- if 'sticky empty' in rout.strip():
+ # An additional ',' is there for newer platforms
+ if 'sticky empty' or 'sticky, empty' in rout.strip():
stat = get_file_stat(host, fqpath)
if int(stat['size']) == 0:
- # xattr = get_fattr(host, fqpath,
- # 'trusted.glusterfs.dht.linkto')
xattr = get_dht_linkto_xattr(host, fqpath)
if xattr is not None:
return True
-
return False