attempt to add service to chkconfig when suggested

This commit is contained in:
Jeffrey Chu 2013-03-18 01:13:41 -07:00
parent 78f82a089d
commit b4789f13a7

View file

@ -464,6 +464,9 @@ class LinuxService(Service):
if self.enable_cmd.endswith("chkconfig"):
(rc, out, err) = self.execute_command("%s --list %s" % (self.enable_cmd, self.name))
if 'chkconfig --add %s' % self.name in err:
self.execute_command("%s --add %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:
self.module.exit_json(msg="unknown service name")
state = out.split()[-1]