Merge pull request #2440 from jochu/service-chkconfig-add

attempt to add service to chkconfig when suggested
This commit is contained in:
Michael DeHaan 2013-03-24 14:33:17 -07:00
commit 5993866df9

View file

@ -474,6 +474,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.fail_json(msg="unknown service name")
state = out.split()[-1]