Merge branch 'fix_service_with_initscript' of git://github.com/psvo/ansible into devel

This commit is contained in:
Michael DeHaan 2013-08-10 18:05:35 -04:00
commit 003c86e250

View file

@ -458,7 +458,7 @@ class LinuxService(Service):
elif initctl_status_stdout.find("start/running") != -1: elif initctl_status_stdout.find("start/running") != -1:
self.running = True self.running = True
if self.svc_cmd.endswith("rc-service") and self.running is None: if self.svc_cmd and self.svc_cmd.endswith("rc-service") and self.running is None:
openrc_rc, openrc_status_stdout, openrc_status_stderr = self.execute_command("%s %s status" % (self.svc_cmd, self.name)) openrc_rc, openrc_status_stdout, openrc_status_stderr = self.execute_command("%s %s status" % (self.svc_cmd, self.name))
self.running = "started" in openrc_status_stdout self.running = "started" in openrc_status_stdout
self.crashed = "crashed" in openrc_status_stderr self.crashed = "crashed" in openrc_status_stderr
@ -626,7 +626,7 @@ class LinuxService(Service):
# In OpenRC, if a service crashed, we need to reset its status to # In OpenRC, if a service crashed, we need to reset its status to
# stopped with the zap command, before we can start it back. # stopped with the zap command, before we can start it back.
if self.svc_cmd.endswith('rc-service') and self.action == 'start' and self.crashed: if self.svc_cmd and self.svc_cmd.endswith('rc-service') and self.action == 'start' and self.crashed:
self.execute_command("%s zap" % svc_cmd, daemonize=True) self.execute_command("%s zap" % svc_cmd, daemonize=True)
if self.action is not "restart": if self.action is not "restart":