From: Alfredo Deza Date: Wed, 16 Oct 2013 21:11:24 +0000 (-0400) Subject: get_connection now will construct the username and host for you X-Git-Tag: v1.3~14^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b98b49f927f76783a5f84d87781c6fc0067fd13b;p=ceph-deploy.git get_connection now will construct the username and host for you Signed-off-by: Alfredo Deza --- diff --git a/ceph_deploy/connection.py b/ceph_deploy/connection.py index d380cbe..3a49742 100644 --- a/ceph_deploy/connection.py +++ b/ceph_deploy/connection.py @@ -2,11 +2,13 @@ import getpass from ceph_deploy.lib.remoto import Connection -def get_connection(hostname, logger, threads=5): +def get_connection(hostname, username, logger, threads=5): """ A very simple helper, meant to return a connection that will know about the need to use sudo. """ + if username: + hostname = "%s@%s" % (username, hostname) try: conn = Connection( hostname, @@ -18,6 +20,7 @@ def get_connection(hostname, logger, threads=5): # Set a timeout value in seconds to disconnect and move on # if no data is sent back. conn.global_timeout = 300 + logger.debug("connected to host: %s " % hostname) return conn except Exception as error: