From: Sebastian Wagner Date: Fri, 27 Mar 2020 22:24:58 +0000 (+0100) Subject: cephadm: Fix trucated output of `mgr dump` X-Git-Tag: v15.2.1~20^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F34258%2Fhead;p=ceph.git cephadm: Fix trucated output of `mgr dump` 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 Signed-off-by: Sebastian Wagner (cherry picked from commit 6a6759eef06c32efe1a10190925da6bc7e5ec4b0) --- diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index 50a5b78a2f6..baccd7c0505 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -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