pybind/ceph_argparse: cast to strs before joining them

we cannot concat a list of float or int by joining them with "|".

Signed-off-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
Kefu Chai 2021-06-13 17:07:22 +08:00
parent ce823359ce
commit eb1e9e2410

View File

@ -256,8 +256,7 @@ class CephInt(CephArgtype):
if range == '':
self.range = list()
else:
self.range = list(range.split('|'))
self.range = [int(x) for x in self.range]
self.range = [int(x) for x in range.split('|')]
def valid(self, s, partial=False):
try:
@ -283,7 +282,7 @@ class CephInt(CephArgtype):
def argdesc(self, attrs):
if self.range:
attrs['range'] = '|'.join(self.range)
attrs['range'] = '|'.join(str(v) for v in self.range)
return super().argdesc(attrs)
@ -296,8 +295,7 @@ class CephFloat(CephArgtype):
if range == '':
self.range = list()
else:
self.range = list(range.split('|'))
self.range = [float(x) for x in self.range]
self.range = [float(x) for x in range.split('|')]
def valid(self, s, partial=False):
try:
@ -322,7 +320,7 @@ class CephFloat(CephArgtype):
def argdesc(self, attrs):
if self.range:
attrs['range'] = '|'.join(self.range)
attrs['range'] = '|'.join(str(v) for v in self.range)
return super().argdesc(attrs)