From f1829a0f865204bf8b165ea7250f218cec14583c Mon Sep 17 00:00:00 2001 From: Jeffrey Chu Date: Mon, 18 Mar 2013 01:13:41 -0700 Subject: [PATCH] attempt to add service to chkconfig when suggested --- library/service | 3 +++ 1 file changed, 3 insertions(+) diff --git a/library/service b/library/service index fb1da54df7..80df521097 100644 --- a/library/service +++ b/library/service @@ -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]