]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
pybind/mgr: enhance CLICommand to fetch extra args from wrapped funcs
authorJohn Mulligan <jmulligan@redhat.com>
Mon, 11 Apr 2022 19:03:12 +0000 (15:03 -0400)
committerAdam King <adking@redhat.com>
Sat, 21 May 2022 23:21:42 +0000 (19:21 -0400)
commit40c84ec426677f084f2bf20bf45844997587ca88
tree4d8a6bb96832729206d81682fd014e9bd810dd07
parent2715e7d5c90df89df57bd768a77f42feac630c47
pybind/mgr: enhance CLICommand to fetch extra args from wrapped funcs

Previously, the CLICommand decorator "assumed" that the decorator was
applied directly to a mgr module api endpoint function. Now that we plan
on adding the Responder decorator into the mix we need a way of
properly fetching the arguments of the endpoint function. In addition,
the decorator itself needs to provide extra arguments to the mgr
(in cases where the endpoint function doesn't explicitly ask for it).
Thus we add a helper function to find the endpoint function when
wrapped as well as extract extra arguments when "walking" the stack
of __wrapped__ functions.

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