From: Zack Cerza Date: Tue, 2 May 2017 17:09:40 +0000 (-0600) Subject: Remote: add init_system property X-Git-Tag: 1.1.0~384^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=15d2edded116ba0866f4700181e89bcc38e0119c;p=teuthology.git Remote: add init_system property 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 --- diff --git a/teuthology/orchestra/remote.py b/teuthology/orchestra/remote.py index 441ece30..7d064459 100644 --- a/teuthology/orchestra/remote.py +++ b/teuthology/orchestra/remote.py @@ -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()