]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
Remote: add init_system property
authorZack Cerza <zack@redhat.com>
Tue, 2 May 2017 17:09:40 +0000 (11:09 -0600)
committerZack Cerza <zack@redhat.com>
Thu, 21 Sep 2017 18:49:10 +0000 (12:49 -0600)
So far, this only exists to answer the question: "does this host use
systemd?" - in which case it will return 'systemd'. Else it will return
None.

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

index 441ece30a7823540f4b53b48b547a0b3eb17ea1e..7d06445966893afc1775f943e346a8de713a64eb 100644 (file)
@@ -451,6 +451,23 @@ class Remote(object):
             self._is_vm = teuthology.lock.query.is_vm(self.name)
         return self._is_vm
 
+    @property
+    def init_system(self):
+        """
+        Which init system does the remote use?
+
+        :returns: 'systemd' or None
+        """
+        if not hasattr(self, '_init_system'):
+            self._init_system = None
+            proc = self.run(
+                args=['which', 'systemctl'],
+                check_status=False,
+            )
+            if proc.returncode == 0:
+                self._init_system = 'systemd'
+        return self._init_system
+
     def __del__(self):
         if self.ssh is not None:
             self.ssh.close()