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
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