]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-daemon: tolerate systemctl is-* exit codes
authorSage Weil <sage@redhat.com>
Fri, 25 Oct 2019 21:46:09 +0000 (16:46 -0500)
committerSage Weil <sage@redhat.com>
Fri, 25 Oct 2019 22:58:19 +0000 (17:58 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/ceph-daemon

index 6dfc456c004732a889fbafc92ec2363cd341dad8..32c594a3164ca485976bd1f64fa3bf7d838d1afa 100755 (executable)
@@ -208,18 +208,17 @@ def get_unit_name(fsid, daemon_type, daemon_id):
     return 'ceph-%s@%s.%s' % (fsid, daemon_type, daemon_id)
 
 def check_unit(unit_name):
+    # NOTE: we ignore the exit code here because systemctl outputs
+    # various exit codes based on the state of the service, but the
+    # string result is more explicit (and sufficient).
     try:
         out, err, code = call(['systemctl', 'is-enabled', unit_name], 'systemctl')
-        if code:
-            raise RuntimeError('exited with %d' % code)
         enabled = out.strip() == 'enabled'
     except Exception as e:
         logger.warning('unable to run systemctl: %s' % e)
         enabled = False
     try:
         out, err, code = call(['systemctl', 'is-active', unit_name], 'systemctl')
-        if code:
-            raise RuntimeError('exited with %d' % code)
         active = out.strip() == 'active'
     except Exception as e:
         logger.warning('unable to run systemctl: %s' % e)