diff options
author | kshithijiyer <kshithij.ki@gmail.com> | 2020-08-10 14:44:12 +0530 |
---|---|---|
committer | Bala Konda Reddy M <bala12352@gmail.com> | 2020-08-11 05:11:42 +0000 |
commit | d4ee7ad936e45019275e536f0041addee54812c4 (patch) | |
tree | d05e8fa7db63beeb4f5e2799079ae9a804df957a /glustolibs-gluster/glustolibs/gluster/mount_ops.py | |
parent | 859fe721ae12b4d4eeb342954805ce2b51120d7e (diff) |
[Libfix] Fix UnicodeDecodeError in get_fattr()
Problem:
Some testcases fail with UnicodeDecodeError when
the framework is run using python3. This happens becuase
the get_fattr() command returns non-unicode output
which leads to data.decode() used in subprocess.Popen
to fail. This isn't the case in python2 as it doesn't
bother about encoding and dumps whatever is the output back
to the management node.
```
gfid = get_fattr(brick_tuple[0], brick_path + '/' + direc,
'trusted.gfid')
/root/glusto-tests/tests/functional/dht/test_dht_create_dir.py:127:
/usr/local/lib/python3.8/site-packages/glustolibs_gluster-0.22-py3.8.egg/glustolibs/gluster/glusterfile.py:113: in get_fattr
rcode, rout, rerr = g.run(host, command)
/usr/local/lib/python3.8/site-packages/glusto-0.72-py3.8.egg/glusto/connectible.py:132: in run
stdout, stderr = proc.communicate()
/usr/lib64/python3.8/subprocess.py:1024: in communicate
stdout, stderr = self._communicate(input, endtime, timeout)
/usr/lib64/python3.8/subprocess.py:1904: in _communicate
stdout = self._translate_newlines(stdout,
self = <subprocess.Popen object at 0x7f22b4e2f490>, data = b'\xber\t\nO\xebO\xee\xa4\x9c\xc4L\xac\x1cj\xd5',
encoding = 'UTF-8', errors = 'strict'
def _translate_newlines(self, data, encoding, errors):
data = data.decode(encoding, errors)
E UnicodeDecodeError: 'utf-8' codec can't decode byte 0xbe in position 0: invalid start byte
/usr/lib64/python3.8/subprocess.py:901: UnicodeDecodeError
```
Solution:
Change get_fattr() command to return xattr value
in hex to avoid UnicodeDecodeError error from
Popen.
Fixes: https://github.com/gluster/glusto-tests/issues/24
Change-Id: I8c4786c882adf6079404b97eca2c399535db068f
Signed-off-by: kshithijiyer <kshithij.ki@gmail.com>
Diffstat (limited to 'glustolibs-gluster/glustolibs/gluster/mount_ops.py')
0 files changed, 0 insertions, 0 deletions