]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-deploy.git/commitdiff
discover.py: remove get_file() use misc.get_file() instead 5/head
authorDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Thu, 21 Mar 2013 15:40:19 +0000 (16:40 +0100)
committerDanny Al-Gaaf <danny.al-gaaf@bisect.de>
Thu, 21 Mar 2013 15:40:19 +0000 (16:40 +0100)
Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
ceph_deploy/discover.py

index a6b8755e2cef923a988db796eaedccef930e389d..5b35eadde7e60d3e899af662fd18fc7bf498b03a 100644 (file)
@@ -1,22 +1,13 @@
 import logging
 import os.path
 
+from . import misc
 from .cliutil import priority
 
 
 LOG = logging.getLogger(__name__)
 
 
-def get_file(path):
-    """
-    Run on remote node, grab a file.
-    """
-    try:
-        with file(path, 'rb') as f:
-            return f.read()
-    except IOError:
-        pass
-
 def fetch_file(args, frompath, topath, hosts):
     # mon.
     if os.path.exists(topath):
@@ -26,7 +17,7 @@ def fetch_file(args, frompath, topath, hosts):
         for hostname in hosts:
             LOG.debug('Checking %s for %s', hostname, frompath)
             sudo = args.pushy('ssh+sudo:{hostname}'.format(hostname=hostname))
-            get_file_r = sudo.compile(get_file)
+            get_file_r = sudo.compile(misc.get_file)
             key = get_file_r(path=frompath.format(hostname=hostname))
             if key is not None:
                 LOG.debug('Got %s from %s, writing locally', topath, hostname)