]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-daemon: fix `systemctl is-enabled` bool 31870/head
authorMichael Fritch <mfritch@suse.com>
Tue, 26 Nov 2019 02:29:26 +0000 (19:29 -0700)
committerMichael Fritch <mfritch@suse.com>
Tue, 26 Nov 2019 02:29:26 +0000 (19:29 -0700)
systemd run-time units were not correctly detected as `enabled`

Signed-off-by: Michael Fritch <mfritch@suse.com>
src/ceph-daemon/ceph-daemon

index 380c144cadd60777af10cf2484786b6b3d8ed40d..80a22183294adddd61fd1a7c8fe007563df6bcbb 100755 (executable)
@@ -300,10 +300,12 @@ 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).
+    enabled = False
     try:
         out, err, code = call(['systemctl', 'is-enabled', unit_name],
                               verbose_on_failure=False)
-        enabled = out.strip() == 'enabled'
+        if code == 0:
+            enabled = True
     except Exception as e:
         logger.warning('unable to run systemctl: %s' % e)
         enabled = False