]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
pybind/mgr/orchestrator: do not pass cmd_args or desc to CLICommand anymore
authorKefu Chai <kchai@redhat.com>
Sun, 27 Dec 2020 14:46:59 +0000 (22:46 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 15 Jan 2021 09:25:27 +0000 (17:25 +0800)
they will be attached to the handler function as annotations and docstring

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/pybind/mgr/orchestrator/_interface.py

index 2542b92398d28e5ed38ce61cc326042011050f69..fb752663820c8c885a2d71047487f878f9eb598a 100644 (file)
@@ -84,7 +84,7 @@ def set_exception_subject(kind, subject, overwrite=False):
         raise
 
 
-def handle_exception(prefix, cmd_args, desc, perm, func):
+def handle_exception(prefix, perm, func):
     @wraps(func)
     def wrapper(*args, **kwargs):
         try:
@@ -101,15 +101,16 @@ def handle_exception(prefix, cmd_args, desc, perm, func):
     # misuse partial to copy `wrapper`
     wrapper_copy = lambda *l_args, **l_kwargs: wrapper(*l_args, **l_kwargs)
     wrapper_copy._prefix = prefix  # type: ignore
-    wrapper_copy._cli_command = CLICommand(prefix, cmd_args, desc, perm)  # type: ignore
+    wrapper_copy._cli_command = CLICommand(prefix, perm)  # type: ignore
+    wrapper_copy._cli_command.store_func_metadata(func)  # type: ignore
     wrapper_copy._cli_command.func = wrapper_copy  # type: ignore
 
     return wrapper_copy
 
 
 def _cli_command(perm):
-    def inner_cli_command(prefix, cmd_args="", desc=""):
-        return lambda func: handle_exception(prefix, cmd_args, desc, perm, func)
+    def inner_cli_command(prefix):
+        return lambda func: handle_exception(prefix, perm, func)
     return inner_cli_command