Skip to content

Commit

Permalink
Service: Fix service not running reported as error
Browse files Browse the repository at this point in the history
  • Loading branch information
philpep committed May 20, 2015
1 parent 435aae3 commit e648054
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion testinfra/modules/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,13 @@ class LinuxService(Service):

@property
def is_running(self):
return self.run_test("service %s status", self.name).rc == 0
# based on /lib/lsb/init-functions
# 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
return self.run_expect(
[0, 1, 3], "service %s status", self.name).rc == 0

@property
def is_enabled(self):
Expand Down

0 comments on commit e648054

Please sign in to comment.