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

Function check

src/pybind/mgr/mgr_module.py:584–598  ·  view source on GitHub ↗
(*args: Any, **kwargs: Any)

Source from the content-addressed store, hash-verified

582 def CheckFileInput(func: HandlerFuncType) -> HandlerFuncType:
583 @functools.wraps(func)
584 def check(*args: Any, **kwargs: Any) -> Tuple[int, str, str]:
585 if 'inbuf' not in kwargs:
586 return -errno.EINVAL, '', f'{ERROR_MSG_NO_INPUT_FILE}: Please specify the file '\
587 f'containing {desc} with "-i" option'
588 if isinstance(kwargs['inbuf'], str):
589 # Delete new line separator at EOF (it may have been added by a text editor).
590 kwargs['inbuf'] = kwargs['inbuf'].rstrip('\r\n').rstrip('\n')
591 if not kwargs['inbuf'] or not kwargs['inbuf'].strip():
592 return (
593 -errno.EINVAL,
594 '',
595 f'{ERROR_MSG_EMPTY_INPUT_FILE}: Please add {desc} to '
596 'the file'
597 )
598 return func(*args, **kwargs)
599 check.__signature__ = inspect.signature(func) # type: ignore[attr-defined]
600 return check
601 return CheckFileInput

Callers 1

Calls 6

funcFunction · 0.85
close_dbMethod · 0.80
open_dbMethod · 0.80
db_readyMethod · 0.80
errorMethod · 0.45
debugMethod · 0.45

Tested by

no test coverage detected