]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: fix host connection exception 33935/head
authorSage Weil <sage@redhat.com>
Sat, 14 Mar 2020 15:07:34 +0000 (10:07 -0500)
committerSage Weil <sage@redhat.com>
Sat, 14 Mar 2020 15:07:34 +0000 (10:07 -0500)
1- catch exception thrown by _get_connection itself
2- make the error message more informative.  the old one was

Error ENOENT: New host dael (10.3.64.25) failed to connect: `ssh -F /tmp/cephadm-conf-9tvrgrls -i /tmp/cephadm-identity-sj66ado1 root@10.3.64.25`

which was both misleading and had irrelevant information.  Now,

Error ENOENT: Failed to connect to dael (10.3.64.25).  Check that the host is reachable and accepts connections using the cephadm SSH key

Signed-off-by: Sage Weil <sage@redhat.com>
src/pybind/mgr/cephadm/module.py

index f8a978947e1b59065c4f965a1fa94afeeb6a9ee2..25134e6161dcb7bcbefe19f6664241339e89d7d9 100644 (file)
@@ -1465,9 +1465,10 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule):
         """
         if not addr and host in self.inventory:
             addr = self.inventory[host].get('addr', host)
-        conn, connr = self._get_connection(addr)
 
         try:
+            conn, connr = self._get_connection(addr)
+
             assert image or entity
             if not image:
                 daemon_type = entity.split('.', 1)[0] # type: ignore
@@ -1539,8 +1540,10 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule):
             return out, err, code
 
         except execnet.gateway_bootstrap.HostNotFound as e:
-            raise OrchestratorError('New host %s (%s) failed to connect: `ssh %s`' % (
-                host, addr, str(e))) from e
+            # this is a misleading exception as it seems to be thrown for
+            # any sort of connection failure, even those having nothing to
+            # do with "host not found" (e.g., ssh key permission denied).
+            raise OrchestratorError('Failed to connect to %s (%s).  Check that the host is reachable and accepts connections using the cephadm SSH key' % (host, addr)) from e
         except Exception as ex:
             self.log.exception(ex)
             raise