From 98039386639e7c10a247aaca30db9dd3e661ae7c Mon Sep 17 00:00:00 2001 From: Patrik Lundin Date: Thu, 11 Dec 2014 23:01:23 +0100 Subject: [PATCH] Handle string returned by 'default' correctly. We need to handle the string returned by 'default' in the same way we handle the string returned by 'status' since the resulting flags are compared later. --- lib/ansible/modules/system/service.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/system/service.py b/lib/ansible/modules/system/service.py index a612e1aa291..46cd3dba569 100644 --- a/lib/ansible/modules/system/service.py +++ b/lib/ansible/modules/system/service.py @@ -994,7 +994,14 @@ class OpenBsdService(Service): if stderr: self.module.fail_json(msg=stderr) - default_flags = stdout.rstrip() + default_string = stdout.rstrip() + + # Depending on the service the string returned from 'default' may be + # either a set of flags or the boolean YES/NO + if default_string == "YES" or default_string == "NO": + default_flags = '' + else: + default_flags = default_string rc, stdout, stderr = self.execute_command("%s %s %s" % (self.enable_cmd, 'status', self.name))