]> 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)
committerAdam King <adking@redhat.com>
Mon, 5 Sep 2022 18:30:24 +0000 (14:30 -0400)
commit357f81a84bbb560cfdac1e073a0ff2a18793f0c6
tree7e27f58d696f808d2d2c9d482c52f848defdcccd
parentb3bf4b795ef1203dae9bf22aa81de642cc4b37ec
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>
(cherry picked from commit a41678a4c700867ba23a299eeafdad23b6840bd0)
src/pybind/mgr/object_format.py