]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
pybind/mgr: add additional decorators for mgr response handling
authorJohn Mulligan <jmulligan@redhat.com>
Thu, 5 May 2022 19:30:17 +0000 (15:30 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Tue, 23 Aug 2022 17:01:45 +0000 (13:01 -0400)
commita41678a4c700867ba23a299eeafdad23b6840bd0
tree36c4b228d228a74a29d903a80f30500b227f89ec
parentd1ca282f60029a551b09180a86ac262a7a68866d
pybind/mgr: add additional decorators for mgr response handling

Add a ErrorResponseHandler decorator for catching and automatically
handling ErrorResponseBase exceptions like Responder does but it *only*
handles exceptions. Normal return value tuples are passed on to the mgr.

Add a EmptyResponder decorator that catches errors but returns "empty"
strings as a response to the mgr. This matches a number of preexisting
functions that don't return json or any other value on success.

Both these decorators are added in order to match behaviors of Responder
decorator without opting into auto formatted responses wholesale. They
are intended to be used when converting older apis to use object_format
module.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
src/pybind/mgr/object_format.py