]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
tests: Fix inconsistent return value in functional test's Container() class
authorTom Hromatka <tom.hromatka@oracle.com>
Mon, 7 Oct 2019 20:44:46 +0000 (14:44 -0600)
committerDhaval Giani <dhaval.giani@oracle.com>
Tue, 8 Oct 2019 17:51:22 +0000 (10:51 -0700)
This commit fixes the Container() class' inconsistent usage
of decode().  In the rootfs() method, it returned a binary
array in one case and a string in another.  Now the rootfs()
method will always return a string.

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Signed-off-by: Dhaval Giani <dhaval.giani@oracle.com>
tests/ftests/container.py

index a078597bba712c441fe0ee1f5693d8a8a6164fbc..6d4a10078599aa18597224025c5680f440a590ad 100644 (file)
@@ -154,14 +154,14 @@ class Container(object):
         # try to read lxc.rootfs.path first
         ret = self.info('lxc.rootfs.path')
         if len(ret.strip()) > 0:
-            return ret
+            return ret.decode()
 
         # older versions of lxc used lxc.rootfs.  Try that.
         ret = self.info('lxc.rootfs')
         if len(ret.strip()) == 0:
             # we failed to get the rootfs
             raise ContainerError('Failed to get the rootfs')
-        return ret.decode('ascii')
+        return ret.decode()
 
     def run(self, cntnr_cmd):
         cmd = list()