From 637764e172b5a4e338eb6cb1e9c36a376ff7bf90 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Sat, 16 Jan 2021 22:54:51 +0800 Subject: [PATCH] pybind/mgr/mgr_module: add poll param to CLICommand and add it to the output of dump_cmd() call, if "poll" is missing in the output of dump_cmd() call, ceph CLI consider the it as False. but it'd be better to be explicit. so this field is always set. Signed-off-by: Kefu Chai (cherry picked from commit 7a2e460d34dc5f7e2124bcbedd527d63fa467017) --- src/pybind/mgr/mgr_module.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/pybind/mgr/mgr_module.py b/src/pybind/mgr/mgr_module.py index 33eed68474171..93da6045c8e1b 100644 --- a/src/pybind/mgr/mgr_module.py +++ b/src/pybind/mgr/mgr_module.py @@ -300,9 +300,10 @@ class CRUSHMap(ceph_module.BasePyCRUSH): class CLICommand(object): COMMANDS = {} # type: Dict[str, CLICommand] - def __init__(self, prefix, perm="rw"): + def __init__(self, prefix, perm="rw", poll=False): self.prefix = prefix self.perm = perm + self.poll = poll self.func = None # type: Optional[Callable] self.arg_spec = {} # type: Dict[str, Any] self.first_default = -1 @@ -383,7 +384,8 @@ class CLICommand(object): return { 'cmd': '{} {}'.format(self.prefix, self.args), 'desc': self.desc, - 'perm': self.perm + 'perm': self.perm, + 'poll': self.poll, } @classmethod @@ -391,12 +393,12 @@ class CLICommand(object): return [cmd.dump_cmd() for cmd in cls.COMMANDS.values()] -def CLIReadCommand(prefix): - return CLICommand(prefix, "r") +def CLIReadCommand(prefix, poll=False): + return CLICommand(prefix, "r", poll) -def CLIWriteCommand(prefix): - return CLICommand(prefix, "w") +def CLIWriteCommand(prefix, poll=False): + return CLICommand(prefix, "w", poll) def CLICheckNonemptyFileInput(func): -- 2.39.5