From: Alfredo Deza Date: Tue, 10 Sep 2013 14:48:49 +0000 (-0400) Subject: use remoto for the mon_host status check X-Git-Tag: v1.2.4~10^2~8 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2d12dcf733e1a40fab08075412a8574e937be068;p=ceph-deploy.git use remoto for the mon_host status check Signed-off-by: Alfredo Deza --- diff --git a/ceph_deploy/mon.py b/ceph_deploy/mon.py index 372bc65..f4133fa 100644 --- a/ceph_deploy/mon.py +++ b/ceph_deploy/mon.py @@ -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