From f8769edf4ebcc4a2de2e3433018f41027c668995 Mon Sep 17 00:00:00 2001 From: Michael Fritch Date: Mon, 25 Nov 2019 19:29:26 -0700 Subject: [PATCH] ceph-daemon: fix `systemctl is-enabled` bool systemd run-time units were not correctly detected as `enabled` Signed-off-by: Michael Fritch --- src/ceph-daemon/ceph-daemon | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ceph-daemon/ceph-daemon b/src/ceph-daemon/ceph-daemon index 380c144cadd60..80a22183294ad 100755 --- a/src/ceph-daemon/ceph-daemon +++ b/src/ceph-daemon/ceph-daemon @@ -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 -- 2.39.5