From: Rishabh Dave Date: Fri, 24 Mar 2023 15:36:52 +0000 (+0530) Subject: qa/cephfs: upgrade gen_mds_cap_str() in caps_helper X-Git-Tag: v19.0.0~1437^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0934845a3889d6ac5d2c631f00ebb074bc7ece0e;p=ceph.git qa/cephfs: upgrade gen_mds_cap_str() in caps_helper Modify get_mds_cap_str() to accept a tuple with a single member. In this case, the only member is assumed to be a permission, FS name is assigned None type and cephfs_mntpt is assigned '/'. Signed-off-by: Rishabh Dave --- diff --git a/qa/tasks/cephfs/caps_helper.py b/qa/tasks/cephfs/caps_helper.py index abcb0bfd96a0..c35d460fb938 100644 --- a/qa/tasks/cephfs/caps_helper.py +++ b/qa/tasks/cephfs/caps_helper.py @@ -24,8 +24,10 @@ def gen_mon_cap_str(caps): perm, fsname = c[0], None elif len(c) == 2: perm, fsname = c - else: - raise RuntimeError('caps tuple received isn\'t right') + elif len(c) < 1: + raise RuntimeError('received no items caps tuple') + else: # len(c) > 2 + raise RuntimeError('received too many items in caps tuple') return perm, fsname def _gen_mon_cap_str(c): @@ -79,14 +81,16 @@ def gen_mds_cap_str(caps): caps = ((perm1, fsname1, cephfs_mntpt1), (perm2, fsname2, cephfs_mntpt2)) """ def _unpack_tuple(c): - if len(c) == 2: + if len(c) == 1: + perm, fsname, cephfs_mntpt = c[0], None, '/' + elif len(c) == 2: perm, fsname, cephfs_mntpt = c[0], c[1], '/' elif len(c) == 3: perm, fsname, cephfs_mntpt = c - elif len(c) < 2: - raise RuntimeError('received items are too less in caps') + elif len(c) < 1: + raise RuntimeError('received no items caps tuple') else: # len(c) > 3 - raise RuntimeError('received items are too many in caps') + raise RuntimeError('received too many items in caps tuple') return perm, fsname, cephfs_mntpt