if not ctx.fsid:
raise Error('must select the cluster to delete by passing --fsid to proceed')
- def disable_systemd_service(unit_name: str) -> None:
- call(ctx, ['systemctl', 'stop', unit_name],
- verbosity=CallVerbosity.DEBUG)
- call(ctx, ['systemctl', 'reset-failed', unit_name],
- verbosity=CallVerbosity.DEBUG)
- call(ctx, ['systemctl', 'disable', unit_name],
- verbosity=CallVerbosity.DEBUG)
-
logger.info(f'Deleting cluster with fsid: {ctx.fsid}')
# stop + disable individual daemon units
continue
if d['style'] != 'cephadm:v1':
continue
- disable_systemd_service('ceph-%s@%s' % (ctx.fsid, d['name']))
+ terminate_service(ctx, 'ceph-%s@%s' % (ctx.fsid, d['name']))
# cluster units
for unit_name in ['ceph-%s.target' % ctx.fsid]:
- disable_systemd_service(unit_name)
+ terminate_service(ctx, unit_name)
slice_name = 'system-ceph\\x2d{}.slice'.format(ctx.fsid.replace('-', '\\x2d'))
call(ctx, ['systemctl', 'stop', slice_name],
# if last cluster on host remove shared files
if get_ceph_cluster_count(ctx) == 0:
- disable_systemd_service('ceph.target')
+ terminate_service(ctx, 'ceph.target')
# rm shared ceph target files
call_throws(ctx, ['rm', '-f', ctx.unit_dir + '/multi-user.target.wants/ceph.target'])
###############################################3
- def test_config(self, cephadm_fs):
+ def test_config(self, cephadm_fs, funkypatch):
+ funkypatch.patch('cephadmlib.systemd.call')
+
conf_file = 'foo'
cmd = self._get_cmd(
'--mon-ip', '192.168.1.1',
retval = _cephadm.command_bootstrap(ctx)
assert retval == 0
- def test_no_mon_addr(self, cephadm_fs):
+ def test_no_mon_addr(self, cephadm_fs, funkypatch):
+ funkypatch.patch('cephadmlib.systemd.call')
+
cmd = self._get_cmd()
with with_cephadm_ctx(cmd) as ctx:
msg = r'must specify --mon-ip or --mon-addrv'
with pytest.raises(_cephadm.Error, match=msg):
_cephadm.command_bootstrap(ctx)
- def test_skip_mon_network(self, cephadm_fs):
+ def test_skip_mon_network(self, cephadm_fs, funkypatch):
+ funkypatch.patch('cephadmlib.systemd.call')
cmd = self._get_cmd('--mon-ip', '192.168.1.1')
with with_cephadm_ctx(cmd, list_networks={}) as ctx:
True,
),
])
- def test_mon_ip(self, mon_ip, list_networks, result, cephadm_fs):
+ def test_mon_ip(self, mon_ip, list_networks, result, cephadm_fs, funkypatch):
+ funkypatch.patch('cephadmlib.systemd.call')
+
cmd = self._get_cmd('--mon-ip', mon_ip)
if not result:
with with_cephadm_ctx(cmd, list_networks=list_networks) as ctx:
None,
),
])
- def test_mon_addrv(self, mon_addrv, list_networks, err, cephadm_fs):
+ def test_mon_addrv(self, mon_addrv, list_networks, err, cephadm_fs, funkypatch):
+ funkypatch.patch('cephadmlib.systemd.call')
+
cmd = self._get_cmd('--mon-addrv', mon_addrv)
if err:
with with_cephadm_ctx(cmd, list_networks=list_networks) as ctx:
retval = _cephadm.command_bootstrap(ctx)
assert retval == 0
- def test_allow_fqdn_hostname(self, cephadm_fs):
+ def test_allow_fqdn_hostname(self, cephadm_fs, funkypatch):
+ funkypatch.patch('cephadmlib.systemd.call')
+
hostname = 'foo.bar'
cmd = self._get_cmd(
'--mon-ip', '192.168.1.1',
('00000000-0000-0000-0000-0000deadbeef', None),
('00000000-0000-0000-0000-0000deadbeez', 'not an fsid'),
])
- def test_fsid(self, fsid, err, cephadm_fs):
+ def test_fsid(self, fsid, err, cephadm_fs, funkypatch):
+ funkypatch.patch('cephadmlib.systemd.call')
+
cmd = self._get_cmd(
'--mon-ip', '192.168.1.1',
'--skip-mon-network',