]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/mgr_module: add backward-compatible Command shim for CLICommandBase
authorDavid Galloway <david.galloway@ibm.com>
Fri, 27 Mar 2026 00:36:59 +0000 (20:36 -0400)
committerDavid Galloway <david.galloway@ibm.com>
Fri, 27 Mar 2026 12:57:29 +0000 (08:57 -0400)
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 <david.galloway@ibm.com>
src/pybind/mgr/mgr_module.py

index b6564b69880a9e6e057ad634f9ec16d462278179..3a217fb06dd868a8620013b2454567372f0fa390 100644 (file)
@@ -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