]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-deploy.git/commitdiff
use remoto for the mon_host status check
authorAlfredo Deza <alfredo.deza@inktank.com>
Tue, 10 Sep 2013 14:48:49 +0000 (10:48 -0400)
committerAlfredo Deza <alfredo.deza@inktank.com>
Wed, 11 Sep 2013 15:33:52 +0000 (11:33 -0400)
Signed-off-by: Alfredo Deza <alfredo.deza@inktank.com>
ceph_deploy/mon.py

index 372bc65b3f8188ac47e37adce6be05bccd7a49d8..f4133fa860080f508dbfee8532dd9a0d9ba22418 100644 (file)
@@ -9,7 +9,8 @@ from . import conf
 from . import exc
 from .cliutil import priority
 from .sudo_pushy import get_transport
-from .util import paths, wrappers
+from .util import paths
+from .lib.remoto import Connection, process
 from . import hosts
 from .misc import mon_hosts, remote_shortname
 
@@ -26,28 +27,35 @@ def mon_status(conn, logger, hostname, silent=False):
     running, while ``True`` would mean the monitor is up and running correctly.
     """
     mon = 'mon.%s' % hostname
+    conn = Connection(hostname, logger=logger, sudo=True)
+
     try:
-        out, err, code = wrappers.Popen(
+        out, err, code = process.check(
             conn,
-            logger,
             ['ceph', 'daemon', mon, 'mon_status']
         )
 
+        for line in err:
+            logger.error(line)
+
         try:
-            mon_info = json.loads(out)
+            mon_info = json.loads(''.join(out))
         except ValueError:
             logger.warning('monitor: %s, might not be running yet' % mon)
             return False
         if not silent:
             logger.debug('*'*80)
             logger.debug('status for monitor: %s' % mon)
-            for k, v in mon_info.items():
-                logger.debug('%s: %s' % (k, v))
+            for line in out:
+                logger.debug(line)
             logger.debug('*'*80)
         if mon_info['rank'] >= 0:
+            logger.info('monitor: %s is running' % mon)
             return True
+        logger.info('monitor: %s is not running' % mon)
         return False
     except RuntimeError:
+        logger.info('monitor: %s is not running' % mon)
         return False