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

Method valid

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

Source from the content-addressed store, hash-verified

570 self.nameid: Optional[int] = None
571
572 def valid(self, s, partial=False):
573 if s == '*':
574 self.val = s
575 return
576 if s.find('.') != -1:
577 t, i = s.split('.', 1)
578 if t != 'osd':
579 raise ArgumentValid('unknown type ' + t)
580 else:
581 t = 'osd'
582 i = s
583 try:
584 v = int(i)
585 except ValueError:
586 raise ArgumentFormat(f'osd id {i} not integer')
587 if v < 0:
588 raise ArgumentFormat(f'osd id {v} is less than 0')
589 self.nametype = t
590 self.nameid = v
591 self.val = v
592
593 def __str__(self):
594 return '<osdname (id|osd.id)>'

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected