NodeProxy,
)
from cephadmlib.agent import http_query
-from cephadmlib.listing import daemons_matching, LegacyDaemonEntry
+from cephadmlib.listing import (
+ LegacyDaemonEntry,
+ daemons_matching,
+ daemons_summary,
+)
FuncT = TypeVar('FuncT', bound=Callable)
if cp.has_option('global', 'fsid'):
fsids.add(cp.get('global', 'fsid'))
- daemon_list = list_daemons(ctx, detail=False)
+ daemon_list = daemons_summary(ctx)
for daemon in daemon_list:
if not is_fsid(daemon['fsid']):
# 'unknown' fsid
return os.path.join(data_dir, 'config')
def get_mon_daemon_name(fsid: str) -> Optional[str]:
- daemon_list = list_daemons(ctx, detail=False)
+ daemon_list = daemons_summary(ctx)
for daemon in daemon_list:
if (
daemon.get('name', '').startswith('mon.')
# stop + disable individual daemon units
sd_paths = []
- for d in list_daemons(ctx, detail=False):
+ for d in daemons_summary(ctx):
if d['fsid'] != ctx.fsid:
continue
if d['style'] != 'cephadm:v1':
def command_update_osd_service(ctx: CephadmContext) -> int:
"""update service for provided daemon"""
update_daemons = [f'osd.{osd_id}' for osd_id in ctx.osd_ids.split(',')]
- daemons = list_daemons(ctx, detail=False, type_of_daemon='osd')
+ daemons = daemons_summary(ctx, daemon_type='osd')
if not daemons:
raise Error(f'Daemon {ctx.osd_ids} does not exists on this host')
available_daemons = [d['name'] for d in daemons]
r'Cannot infer an fsid',
),
])
- @mock.patch('cephadm.call')
- @mock.patch('cephadm.logger')
- def test_infer_fsid(self, _logger, _call, fsid, ceph_conf, list_daemons, result, err, cephadm_fs):
+ def test_infer_fsid(self, fsid, ceph_conf, list_daemons, result, err, cephadm_fs, funkypatch):
+ funkypatch.patch('cephadm.logger')
+ funkypatch.patch('cephadm.call')
# build the context
ctx = _cephadm.CephadmContext()
ctx.fsid = fsid
ctx.config = f.path
# test
+ funkypatch.patch(
+ 'cephadmlib.listing.daemons_summary'
+ ).return_value = list_daemons
with mock.patch('cephadm.list_daemons', return_value=list_daemons):
if err:
with pytest.raises(_cephadm.Error, match=err):