Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion testinfra/modules/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,12 @@ def exists(self):

@property
def is_running(self):
out = self.run_expect([0, 1, 3], "systemctl is-active %s", self.name)
# based on https://man7.org/linux/man-pages/man1/systemctl.1.html
# 0: program running
# 1: program is dead and pid file exists
# 3: not running and pid file does not exists
# 4: Unable to determine status (no such unit)
out = self.run_expect([0, 1, 3, 4], "systemctl is-active %s", self.name)
if out.rc == 1:
# Failed to connect to bus: No such file or directory
return super().is_running
Expand Down