]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
DaemonGroup: Detect and use systemd
authorZack Cerza <zack@redhat.com>
Tue, 2 May 2017 17:14:59 +0000 (11:14 -0600)
committerZack Cerza <zack@redhat.com>
Thu, 21 Sep 2017 18:49:10 +0000 (12:49 -0600)
Don't rely on a configuration item to tell us whether or not to use
systemd.

Signed-off-by: Zack Cerza <zack@redhat.com>
teuthology/orchestra/daemon/group.py

index 574d9c05576a77cc37d40b6b8b53c5373648f455..befc9417b7ab055fdc121e4284f9d0d7e9278924 100644 (file)
@@ -7,13 +7,12 @@ class DaemonGroup(object):
     """
     Collection of daemon state instances
     """
-    def __init__(self, use_init=False):
+    def __init__(self):
         """
         self.daemons is a dictionary indexed by role.  Each entry is a
         dictionary of DaemonState values indexed by an id parameter.
         """
         self.daemons = {}
-        self.use_init = use_init
 
     def add_daemon(self, remote, type_, id_, *args, **kwargs):
         """
@@ -31,7 +30,7 @@ class DaemonGroup(object):
         self.register_daemon(remote, type_, id_, *args, **kwargs)
         cluster = kwargs.pop('cluster', 'ceph')
         role = cluster + '.' + type_
-        if not self.use_init:
+        if remote.init_system is None:
             self.daemons[role][id_].restart()
 
     def register_daemon(self, remote, type_, id_, *args, **kwargs):
@@ -55,7 +54,7 @@ class DaemonGroup(object):
             self.daemons[role][id_].stop()
             self.daemons[role][id_] = None
         klass = DaemonState
-        if self.use_init == 'systemd':
+        if remote.init_system == 'systemd':
             klass = SystemDState
         self.daemons[role][id_] = klass(
             remote, role, id_, *args, **kwargs)