From: David Galloway Date: Fri, 27 Mar 2026 00:36:59 +0000 (-0400) Subject: mgr/mgr_module: add backward-compatible Command shim for CLICommandBase X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=fc1b98fc47b84504552f9ea3f4816978c9e904f7;p=ceph.git mgr/mgr_module: add backward-compatible Command shim for CLICommandBase The dashboard module and others instantiate Command with a handler keyword argument, which CLICommandBase does not support. Add a Command subclass that accepts the old constructor signature so these modules continue to load correctly. Signed-off-by: David Galloway --- diff --git a/src/pybind/mgr/mgr_module.py b/src/pybind/mgr/mgr_module.py index b6564b69880a..3a217fb06dd8 100644 --- a/src/pybind/mgr/mgr_module.py +++ b/src/pybind/mgr/mgr_module.py @@ -561,6 +561,15 @@ class CLICommandBase(object): }) +class Command(CLICommandBase): + """Backward-compatible shim for modules that use Command(prefix, handler=func)""" + def __init__(self, prefix: str, perm: str = 'rw', poll: bool = False, + handler: Optional[Callable] = None, **kwargs: Any): + super().__init__(prefix, perm, poll) + if handler is not None: + self._register_handler(handler) + + # Backward-compatible alias: the mgr daemon binary imports CLICommand by name CLICommand = CLICommandBase # Backward-compatible aliases for built-in modules that import these names