]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/tasks: Include stderr on tasks badness check. 48539/head
authorChristopher Hoffman <choffman@redhat.com>
Tue, 18 Oct 2022 20:14:19 +0000 (20:14 +0000)
committerIlya Dryomov <idryomov@gmail.com>
Tue, 14 Jan 2025 19:40:40 +0000 (20:40 +0100)
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 <idryomov@gmail.com>
Signed-off-by: Christopher Hoffman <choffman@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
qa/tasks/ceph.py
qa/tasks/cephadm.py
qa/tasks/rook.py

index 9b04e3dc675e0106ad7212ab4cca2a913d1af811..8f666d2fa9b26232ff08e40a8b6b41eb459958a6 100644 (file)
@@ -1206,8 +1206,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:
index dab61c2c7005cc8cfa87eac36f04988623e0e7ec..0cde60507180f0ed81043cbc4f02ed62c41a898c 100644 (file)
@@ -475,12 +475,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
 
         # NOTE: technically the first and third arg to first_in_ceph_log
index 6cb75173966925f2f7661f91ad818fb264087f2c..fae5ef3bf00562c00eb81820438fd473a7f087d9 100644 (file)
@@ -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\]',