From 4a749891c8267e40dfd3cc1af97b432bb78bcf26 Mon Sep 17 00:00:00 2001 From: Christopher Hoffman Date: Tue, 18 Oct 2022 20:14:19 +0000 Subject: [PATCH] qa/tasks: Include stderr on tasks badness check. Make sure that first_in_ceph_log() doesn't return None (which is treated as success/"no badness" by the caller) if the cluster log file is missing. Fixes: https://tracker.ceph.com/issues/57864 Co-authored-by: Ilya Dryomov Signed-off-by: Christopher Hoffman Signed-off-by: Ilya Dryomov (cherry picked from commit 5d92965b31800bd7106e6f40fe4fc78b07e6f2e9) --- qa/tasks/ceph.py | 14 ++++++++++++-- qa/tasks/cephadm.py | 10 +++++++--- qa/tasks/rook.py | 6 +++++- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/qa/tasks/ceph.py b/qa/tasks/ceph.py index a7a0d13e2bd7..ae198effa233 100644 --- a/qa/tasks/ceph.py +++ b/qa/tasks/ceph.py @@ -1149,8 +1149,18 @@ def cluster(ctx, config): args.extend([ run.Raw('|'), 'head', '-n', '1', ]) - stdout = mon0_remote.sh(args) - return stdout or None + r = mon0_remote.run( + stdout=BytesIO(), + args=args, + stderr=StringIO(), + ) + stdout = r.stdout.getvalue().decode() + if stdout: + return stdout + stderr = r.stderr.getvalue() + if stderr: + return stderr + return None if first_in_ceph_log('\[ERR\]|\[WRN\]|\[SEC\]', config['log_ignorelist']) is not None: diff --git a/qa/tasks/cephadm.py b/qa/tasks/cephadm.py index b8627a30c50a..2c25cfd63f1d 100644 --- a/qa/tasks/cephadm.py +++ b/qa/tasks/cephadm.py @@ -316,12 +316,16 @@ def ceph_log(ctx, config): run.Raw('|'), 'head', '-n', '1', ]) r = ctx.ceph[cluster_name].bootstrap_remote.run( - stdout=StringIO(), + stdout=BytesIO(), args=args, + stderr=StringIO(), ) - stdout = r.stdout.getvalue() - if stdout != '': + stdout = r.stdout.getvalue().decode() + if stdout: return stdout + stderr = r.stderr.getvalue() + if stderr: + return stderr return None if first_in_ceph_log('\[ERR\]|\[WRN\]|\[SEC\]', diff --git a/qa/tasks/rook.py b/qa/tasks/rook.py index 427f8324e300..7fa4d8fa0837 100644 --- a/qa/tasks/rook.py +++ b/qa/tasks/rook.py @@ -8,7 +8,7 @@ import json import logging import os import yaml -from io import BytesIO +from io import BytesIO, StringIO from tarfile import ReadError from tasks.ceph_manager import CephManager @@ -235,10 +235,14 @@ def ceph_log(ctx, config): r = ctx.rook[cluster_name].remote.run( stdout=BytesIO(), args=args, + stderr=StringIO(), ) stdout = r.stdout.getvalue().decode() if stdout: return stdout + stderr = r.stderr.getvalue() + if stderr: + return stderr return None if first_in_ceph_log('\[ERR\]|\[WRN\]|\[SEC\]', -- 2.47.3