]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
ceph-daemon: simplify calls from rm_cluster
authorSage Weil <sage@redhat.com>
Thu, 10 Oct 2019 02:26:49 +0000 (21:26 -0500)
committerSage Weil <sage@redhat.com>
Mon, 21 Oct 2019 15:45:24 +0000 (10:45 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/ceph-daemon

index 1579938c3d3c9947b915846817792f9373dbee37..e4e6944c2af08b539ac59521ed2ae3ff728a4eab 100755 (executable)
@@ -1267,28 +1267,18 @@ def command_rm_cluster():
         raise RuntimeError('must pass --force to proceed: '
                            'this command may destroy precious data!')
 
-    unit_name = 'ceph-%s.target' % args.fsid
-    try:
-        call_throws(['systemctl', 'stop', unit_name],
-                    verbose_on_failure=False)
-        call_throws(['systemctl', 'disable', unit_name],
-                    verbose_on_failure=False)
-    except RuntimeError:
-        pass
-    crash_unit_name = 'ceph-%s-crash.service' % args.fsid
-    try:
-        subprocess.check_output(['systemctl', 'stop', crash_unit_name])
-        subprocess.check_output(['systemctl', 'disable', crash_unit_name])
-    except subprocess.CalledProcessError:
-        pass
-
-    slice_name = 'system-%s.slice' % (
-        ('ceph-%s' % args.fsid).replace('-', '\\x2d'))
-    try:
-        call_throws(['systemctl', 'stop', slice_name],
-                    verbose_on_failure=False)
-    except RuntimeError:
-        pass
+    # ignore errors here
+    for unit_name in ['ceph-%s.target' % args.fsid,
+                      'ceph-%s-crash.service' % args.fsid]:
+        call(['systemctl', 'stop', unit_name], 'systemctl',
+             verbose_on_failure=False)
+        call(['systemctl', 'disable', unit_name], 'systemctl',
+             verbose_on_failure=False)
+
+    slice_name = 'system-%s.slice' % (('ceph-%s' % args.fsid).replace('-',
+                                                                      '\\x2d'))
+    call(['systemctl', 'stop', slice_name], 'systemctl',
+         verbose_on_failure=False)
 
     # FIXME: stop + disable individual daemon units, too?