Skip to content

Commit 5d92965

Browse files
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 <[email protected]> Signed-off-by: Christopher Hoffman <[email protected]> Signed-off-by: Ilya Dryomov <[email protected]>
1 parent eb54228 commit 5d92965

File tree

3 files changed

+24
-6
lines changed

3 files changed

+24
-6
lines changed

qa/tasks/ceph.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,8 +1206,18 @@ def first_in_ceph_log(pattern, excludes):
12061206
args.extend([
12071207
run.Raw('|'), 'head', '-n', '1',
12081208
])
1209-
stdout = mon0_remote.sh(args)
1210-
return stdout or None
1209+
r = mon0_remote.run(
1210+
stdout=BytesIO(),
1211+
args=args,
1212+
stderr=StringIO(),
1213+
)
1214+
stdout = r.stdout.getvalue().decode()
1215+
if stdout:
1216+
return stdout
1217+
stderr = r.stderr.getvalue()
1218+
if stderr:
1219+
return stderr
1220+
return None
12111221

12121222
if first_in_ceph_log('\[ERR\]|\[WRN\]|\[SEC\]',
12131223
config['log_ignorelist']) is not None:

qa/tasks/cephadm.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -475,12 +475,16 @@ def first_in_ceph_log(pattern, excludes, only_match):
475475
run.Raw('|'), 'head', '-n', '1',
476476
])
477477
r = ctx.ceph[cluster_name].bootstrap_remote.run(
478-
stdout=StringIO(),
478+
stdout=BytesIO(),
479479
args=args,
480+
stderr=StringIO(),
480481
)
481-
stdout = r.stdout.getvalue()
482-
if stdout != '':
482+
stdout = r.stdout.getvalue().decode()
483+
if stdout:
483484
return stdout
485+
stderr = r.stderr.getvalue()
486+
if stderr:
487+
return stderr
484488
return None
485489

486490
# NOTE: technically the first and third arg to first_in_ceph_log

qa/tasks/rook.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import logging
99
import os
1010
import yaml
11-
from io import BytesIO
11+
from io import BytesIO, StringIO
1212

1313
from tarfile import ReadError
1414
from tasks.ceph_manager import CephManager
@@ -235,10 +235,14 @@ def first_in_ceph_log(pattern, excludes):
235235
r = ctx.rook[cluster_name].remote.run(
236236
stdout=BytesIO(),
237237
args=args,
238+
stderr=StringIO(),
238239
)
239240
stdout = r.stdout.getvalue().decode()
240241
if stdout:
241242
return stdout
243+
stderr = r.stderr.getvalue()
244+
if stderr:
245+
return stderr
242246
return None
243247

244248
if first_in_ceph_log('\[ERR\]|\[WRN\]|\[SEC\]',

0 commit comments

Comments
 (0)