From adfe03b431f13d6982fdb7a85e57f52d765e54f2 Mon Sep 17 00:00:00 2001 From: Alfredo Deza Date: Tue, 1 Oct 2013 13:48:07 -0400 Subject: [PATCH] handle all errors coming from an attempt to connect --- ceph_deploy/connection.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) 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) -- 2.47.3