]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-deploy.git/commitdiff
handle all errors coming from an attempt to connect 95/head
authorAlfredo Deza <alfredo.deza@inktank.com>
Tue, 1 Oct 2013 17:48:07 +0000 (13:48 -0400)
committerAlfredo Deza <alfredo.deza@inktank.com>
Tue, 1 Oct 2013 17:48:07 +0000 (13:48 -0400)
ceph_deploy/connection.py

index 841826db5d0a25166569ee963cd734ffed389966..ae6eee149ecf1f597fbf472a2164e10c477c54e7 100644 (file)
@@ -7,8 +7,14 @@ def get_connection(hostname, logger):
     A very simple helper, meant to return a connection
     that will know about the need to use sudo.
     """
-    return Connection(
-        hostname,
-        logger=logger,
-        sudo=needs_sudo(),
-    )
+    try:
+        return Connection(
+            hostname,
+            logger=logger,
+            sudo=needs_sudo(),
+        )
+
+    except Exception as error:
+        msg = "connecting to host: %s " % hostname
+        errors = "resulted in errors: %s %s" % (error.__class__.__name__, error)
+        raise RuntimeError(msg + errors)