From 8e1e26675206ad331925435456ea2071f259e2db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Knecht?= Date: Fri, 10 Nov 2023 13:56:31 +0100 Subject: [PATCH] testinfra/modules/blockdevice: Don't fail on stderr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `blockdevice` module raises a `RuntimeError` if `blockdev` returns with a non-zero exit code, or if stderr is not empty. But the latter can happen even when there's no failure at all, for instance if `sshd` has a banner message configured (which gets output to stderr whenever someone connects to the host). Signed-off-by: BenoƮt Knecht --- testinfra/modules/blockdevice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testinfra/modules/blockdevice.py b/testinfra/modules/blockdevice.py index 5f129065..fdfd9e0c 100644 --- a/testinfra/modules/blockdevice.py +++ b/testinfra/modules/blockdevice.py @@ -130,7 +130,7 @@ def _data(self): header = ["RO", "RA", "SSZ", "BSZ", "StartSec", "Size", "Device"] command = "blockdev --report %s" blockdev = self.run(command, self.device) - if blockdev.rc != 0 or blockdev.stderr: + if blockdev.rc != 0: raise RuntimeError("Failed to gather data: {}".format(blockdev.stderr)) output = blockdev.stdout.splitlines() if len(output) < 2: