Merge pull request #2439 from jochu/service-chkconfig-fail

fail when service cannot be found by chkconfig
pull/2433/merge
Michael DeHaan 12 years ago
commit a4a1545640

@ -465,7 +465,7 @@ class LinuxService(Service):
if self.enable_cmd.endswith("chkconfig"): if self.enable_cmd.endswith("chkconfig"):
(rc, out, err) = self.execute_command("%s --list %s" % (self.enable_cmd, self.name)) (rc, out, err) = self.execute_command("%s --list %s" % (self.enable_cmd, self.name))
if not self.name in out: if not self.name in out:
self.module.exit_json(msg="unknown service name") self.module.fail_json(msg="unknown service name")
state = out.split()[-1] state = out.split()[-1]
if self.enable and ( "3:on" in out and "5:on" in out ): if self.enable and ( "3:on" in out and "5:on" in out ):
return return

Loading…
Cancel
Save