MCPcopy Create free account
hub / github.com/ceph/ceph / valid

Method valid

src/pybind/ceph_argparse.py:530–556  ·  view source on GitHub ↗
(self, s, partial=False)

Source from the content-addressed store, hash-verified

528 self.nameid: Optional[str] = None
529
530 def valid(self, s, partial=False):
531 if s == '*':
532 self.val = s
533 return
534 elif s == "mgr":
535 self.nametype = "mgr"
536 self.val = s
537 return
538 elif s == "mon":
539 self.nametype = "mon"
540 self.val = s
541 return
542 if s.find('.') == -1:
543 raise ArgumentFormat('CephName: no . in {0}'.format(s))
544 else:
545 t, i = s.split('.', 1)
546 if t not in ('osd', 'mon', 'client', 'mds', 'mgr'):
547 raise ArgumentValid('unknown type ' + t)
548 if t == 'osd':
549 if i != '*':
550 try:
551 int(i)
552 except ValueError:
553 raise ArgumentFormat(f'osd id {i} not integer')
554 self.nametype = t
555 self.val = s
556 self.nameid = i
557
558 def __str__(self):
559 return '<name (type.id)>'

Callers 2

find_cmd_targetFunction · 0.95
json_commandFunction · 0.95

Calls 5

ArgumentFormatClass · 0.85
ArgumentValidClass · 0.85
findMethod · 0.45
formatMethod · 0.45
splitMethod · 0.45

Tested by

no test coverage detected