]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: Fix trucated output of `mgr dump` 34258/head
authorSebastian Wagner <sebastian.wagner@suse.com>
Fri, 27 Mar 2020 22:24:58 +0000 (23:24 +0100)
committerSebastian Wagner <sebastian.wagner@suse.com>
Sat, 28 Mar 2020 00:21:05 +0000 (01:21 +0100)
In case the process has terminated, we
have to make sure to read till EOF, otherwise
we might skip some bytes.

Fixes: https://tracker.ceph.com/issues/44642
Co-authored-by: Tim Serong <tserong@suse.com>
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
(cherry picked from commit 6a6759eef06c32efe1a10190925da6bc7e5ec4b0)

src/cephadm/cephadm

index 50a5b78a2f64408f8b7d1b3258bbee0f281c31ae..baccd7c050514e5385cab8f8af7d5f7636424dd6 100755 (executable)
@@ -638,6 +638,12 @@ def call(command,  # type: List[str]
                     message = message_b.decode('utf-8')
                 if isinstance(message_b, str):
                     message = message_b
+                if stop and message:
+                    # process has terminated, but have more to read still, so not stopping yet
+                    # (os.read returns '' when it encounters EOF)
+                    stop = False
+                if not message:
+                    continue
                 if fd == process.stdout.fileno():
                     out += message
                     message = out_buffer + message