From 43d0fbd34289694a6a3a8cd040f08130ae622f93 Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Sat, 19 Apr 2014 19:01:46 +0200 Subject: [PATCH] Add a better error message for service While migrating my playbook to a newer ansible version, I faced the error message "unknown init system, cannot enable service". It turned out to be caused by a wrong service name that was not expanded anymore. So by giving the name of the service that cannot be enabled and a more precise reason, i think people will be able to diagnose their issue more easily. --- library/system/service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/system/service b/library/system/service index a694d8d92b..ec622acebc 100644 --- a/library/system/service +++ b/library/system/service @@ -565,7 +565,7 @@ class LinuxService(Service): def service_enable(self): if self.enable_cmd is None: - self.module.fail_json(msg='unknown init system, cannot enable service') + self.module.fail_json(msg='cannot detect command to enable service %s, typo or init system potentially unknown' % self.name) # FIXME: we use chkconfig or systemctl # to decide whether to run the command here but need something