From 686026919e09ef940c917f10a9c5c800e7a95aec Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Wed, 12 Aug 2015 18:10:24 -0400 Subject: [PATCH] avoid shlex exceptions in rc parsing (happens with multiline entries) fixes #1898 --- lib/ansible/modules/system/service.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/system/service.py b/lib/ansible/modules/system/service.py index 0d2ea25bf5d..9e2afb46f97 100644 --- a/lib/ansible/modules/system/service.py +++ b/lib/ansible/modules/system/service.py @@ -980,7 +980,11 @@ class FreeBsdService(Service): rc, stdout, stderr = self.execute_command("%s %s %s %s" % (self.svc_cmd, self.name, 'rcvar', self.arguments)) cmd = "%s %s %s %s" % (self.svc_cmd, self.name, 'rcvar', self.arguments) - rcvars = shlex.split(stdout, comments=True) + try: + rcvars = shlex.split(stdout, comments=True) + except: + #TODO: add a warning to the output with the failure + continue if not rcvars: self.module.fail_json(msg="unable to determine rcvar", stdout=stdout, stderr=stderr)