]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-deploy.git/commitdiff
get_connection now will construct the username and host for you
authorAlfredo Deza <alfredo.deza@inktank.com>
Wed, 16 Oct 2013 21:11:24 +0000 (17:11 -0400)
committerAlfredo Deza <alfredo.deza@inktank.com>
Thu, 17 Oct 2013 18:38:57 +0000 (14:38 -0400)
Signed-off-by: Alfredo Deza <alfredo.deza@inktank.com>
ceph_deploy/connection.py

index d380cbe6f8ca906cba2348052dd138675ed3f957..3a49742bc9aef64e2e48bb7176868cd3dd499384 100644 (file)
@@ -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: