Fixes #4448 reloaded services should be started if not running

This commit is contained in:
James Tanner 2013-10-25 15:30:02 -04:00
parent a220d7c18c
commit f27e2fd285

View file

@ -272,7 +272,7 @@ class Service(object):
if self.state and self.running is None: if self.state and self.running is None:
self.module.fail_json(msg="failed determining service state, possible typo of service name?") self.module.fail_json(msg="failed determining service state, possible typo of service name?")
# Find out if state has changed # Find out if state has changed
if not self.running and self.state in ["started", "running"]: if not self.running and self.state in ["started", "running", "reloaded"]:
self.svc_change = True self.svc_change = True
elif self.running and self.state in ["stopped","reloaded"]: elif self.running and self.state in ["stopped","reloaded"]:
self.svc_change = True self.svc_change = True
@ -288,6 +288,8 @@ class Service(object):
# Control service # Control service
if self.state in ['started', 'running']: if self.state in ['started', 'running']:
self.action = "start" self.action = "start"
elif not self.running and self.state == 'reloaded':
self.action = "start"
elif self.state == 'stopped': elif self.state == 'stopped':
self.action = "stop" self.action = "stop"
elif self.state == 'reloaded': elif self.state == 'reloaded':