]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
pybind/ceph_argparse: validate csv if desc.N
authorKefu Chai <kchai@redhat.com>
Wed, 9 Jun 2021 02:01:35 +0000 (10:01 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 14 Jun 2021 01:50:46 +0000 (09:50 +0800)
commit0948a78ee6524911bd1fb76f1bf285e90e3cd349
treeef50de7cf60ced246bfc51fd729d69c71759ade2
parentbc182888a3ca557e330e4317e0c50c1e80dbde4d
pybind/ceph_argparse: validate csv if desc.N

if desc.N is not None, we should take the argument as a comma separated
values, and validate the values individually.

restructure the validate() function and its helpers to pass the
validated args if desc.N explicitly, as desc.instance.val should only
hold a single value of desc.instance type, otherwise we need to reset
it after collecting all the argument in a CSV string value is parsed.

this change would be less consistent and hackish.

and update a test to verify this behavior.

Fixes: https://tracker.ceph.com/issues/51145
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/pybind/ceph_argparse.py
src/test/pybind/test_ceph_argparse.py