]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
pybind/mgr: add a ReturnValueAdapter type to object_format.py
authorJohn Mulligan <jmulligan@redhat.com>
Sat, 9 Apr 2022 18:46:50 +0000 (14:46 -0400)
committerAdam King <adking@redhat.com>
Sat, 21 May 2022 23:20:55 +0000 (19:20 -0400)
commit71d99118d22f99db5ff7ecde1ce45ba4e0779bd9
tree75ef0d37efed0e767b19f1f98f9614f8acac9b99
parent59962229226e222c320a0543243d95bcb9eb4037
pybind/mgr: add a ReturnValueAdapter type to object_format.py

The ReturnValueAdapter type fulfills a similar role to the
ObjectFormatAdapter but instead of serializing data for the
body of a mgr response, extracts an return value (error code)
to reply with.

Most of the time it is totally unnecessary to provide an explicit
return value because if you have are returning a valid object (as
opposed to raising an exception) the return value will be zero
(success). However, in the off chance an type need to directly
communicate a return value for the mgr response it can provide
the `mgr_return_value` method and the adapater will discover
and use it.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit 27787a9905d4d2e1062f7f4977377530d7aa8c23)
src/pybind/mgr/object_format.py