From: Alfredo Deza Date: Tue, 1 Oct 2013 17:48:07 +0000 (-0400) Subject: handle all errors coming from an attempt to connect X-Git-Tag: v1.2.7~5^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F95%2Fhead;p=ceph-deploy.git handle all errors coming from an attempt to connect --- diff --git a/ceph_deploy/connection.py b/ceph_deploy/connection.py index 841826d..ae6eee1 100644 --- a/ceph_deploy/connection.py +++ b/ceph_deploy/connection.py @@ -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)