]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph.in: read bytes from stdin
authorKefu Chai <kchai@redhat.com>
Fri, 4 Sep 2020 02:21:35 +0000 (10:21 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 11 Sep 2020 16:30:55 +0000 (00:30 +0800)
the data read from stdin is used as the input parameter for calls like
`cluster.osd_command(...)` and `cluster.mon_command`. all of them
expect a bytes `inbuf`. in Python2, this sys.stdin.read() returns a str,
and we don't differentiate str from byte back then. but we need enforce
the type now for better readablity and type correctness.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/ceph.in

index d1f4d802214e9d87f44fc3f1695a7c06191ffa21..b2ceafbae65b8465257173e849f148e6814623a4 100755 (executable)
@@ -1104,7 +1104,7 @@ def main():
     if parsed_args.input_file:
         try:
             if parsed_args.input_file == '-':
-                inbuf = sys.stdin.read()
+                inbuf = sys.stdin.buffer.read()
             else:
                 with open(parsed_args.input_file, 'rb') as f:
                     inbuf = f.read()