]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind/rados: construct cmd as an array of a single entry
authorKefu Chai <kchai@redhat.com>
Tue, 1 Sep 2020 05:07:17 +0000 (13:07 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 11 Sep 2020 16:30:54 +0000 (00:30 +0800)
otherwise what monitor receives would be something like

mon_command({ " p r e f i x " :   " o s d   m a p " ...

difficult to parse/grep by machine/human.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/pybind/rados/rados.pyx

index 7ef2d8b546a34d0daaf2e713307ad951e663580c..04acc51dbdd391fd32cdaaa4c3bf8cde39414bd3 100644 (file)
@@ -1381,7 +1381,7 @@ Rados object in state %s." % self.state)
         # timeout argument, but we keep it for backward compat with old python binding
 
         self.require_state("connected")
-        cmd = cstr_list(cmd, 'c')
+        cmd = [cstr(cmd, 'cmd')]
 
         if isinstance(target, int):
         # NOTE(sileht): looks weird but test_monmap_dump pass int
@@ -1439,12 +1439,11 @@ Rados object in state %s." % self.state)
         # timeout argument, but we keep it for backward compat with old python binding
         self.require_state("connected")
 
-        cmd = cstr_list(cmd, 'cmd')
-        inbuf = cstr(inbuf, 'inbuf')
+        cmds = [cstr(cmd, 'cmd')]
 
         cdef:
             int _osdid = osdid
-            char **_cmd = to_bytes_array(cmd)
+            char **_cmd = to_bytes_array(cmds)
             size_t _cmdlen = len(cmd)
 
             char *_inbuf = inbuf
@@ -1481,15 +1480,15 @@ Rados object in state %s." % self.state)
         # timeout argument, but we keep it for backward compat with old python binding
         self.require_state("connected")
 
-        cmd = cstr_list(cmd, 'cmd')
+        cmds = [cstr(cmd, 'cmd')]
         inbuf = cstr(inbuf, 'inbuf')
         target = cstr(target, 'target', opt=True)
 
         cdef:
             char *_target = opt_str(target)
 
-            char **_cmd = to_bytes_array(cmd)
-            size_t _cmdlen = len(cmd)
+            char **_cmd = to_bytes_array(cmds)
+            size_t _cmdlen = len(cmds)
 
             char *_inbuf = inbuf
             size_t _inbuf_len = len(inbuf)