]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: show unhandled exceptions during `host add`
authorMichael Fritch <mfritch@suse.com>
Thu, 19 Aug 2021 21:21:06 +0000 (15:21 -0600)
committerMichael Fritch <mfritch@suse.com>
Wed, 25 Aug 2021 13:20:49 +0000 (07:20 -0600)
138700e59bcd assumes stderr will always have a line containing the
prefix 'ERROR', which leads to an empty error reason when `check-host`
fails with an unhandled exception

Fixes: https://tracker.ceph.com/issues/51818
Signed-off-by: Michael Fritch <mfritch@suse.com>
src/pybind/mgr/cephadm/module.py

index 27d3734e28a0a86bff7d7bfd46b16d5800ba24fc..04bfb340755ce65ccf0475f56976832af607a09e 100644 (file)
@@ -1330,11 +1330,13 @@ Then run the following:
             addr=addr,
             error_ok=True, no_fsid=True)
         if code:
+            msg = 'check-host failed:\n' + '\n'.join(err)
             # err will contain stdout and stderr, so we filter on the message text to
             # only show the errors
             errors = [_i.replace("ERROR: ", "") for _i in err if _i.startswith('ERROR')]
-            raise OrchestratorError('Host %s (%s) failed check(s): %s' % (
-                host, addr, errors))
+            if errors:
+                msg = f'Host {host} ({addr}) failed check(s): {errors}'
+            raise OrchestratorError(msg)
         return ip_addr
 
     def _add_host(self, spec):