From 7181c3ddd91d1d6bd9c8fd8475d1e3e3c41539a1 Mon Sep 17 00:00:00 2001 From: Guillaume Date: Fri, 1 Mar 2024 15:22:30 +0100 Subject: [PATCH] Don't skip empty lines... For some tricky cases we cannot skip empty line. For example when getting a key from varstored with ssh we can have within the key a sequence of two 0x0a bytes. The issue is that readline will split it with an empty line. If we skip it we basically remove one 0x0a from the key and then of course the checksum will failed. Signed-off-by: Guillaume --- lib/commands.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/commands.py b/lib/commands.py index 709d1cf98..841f52e38 100644 --- a/lib/commands.py +++ b/lib/commands.py @@ -110,9 +110,8 @@ def _ssh(hostname_or_ip, cmd, check=True, simple_output=True, suppress_fingerpri stdout = [] for line in iter(process.stdout.readline, b''): readable_line = line.decode(errors='replace').strip() - if readable_line != '': - stdout.append(line) - OUPUT_LOGGER.debug(readable_line) + stdout.append(line) + OUPUT_LOGGER.debug(readable_line) _, stderr = process.communicate() res = subprocess.CompletedProcess(ssh_cmd, process.returncode, b''.join(stdout), stderr)