From 15d2edded116ba0866f4700181e89bcc38e0119c Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Tue, 2 May 2017 11:09:40 -0600 Subject: [PATCH] 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 --- teuthology/orchestra/remote.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/teuthology/orchestra/remote.py b/teuthology/orchestra/remote.py index 441ece30a7..7d06445966 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() -- 2.39.5