avoid shlex exceptions in rc parsing (happens with multiline entries) fixes #1898

This commit is contained in:
Brian Coca 2015-08-12 18:10:24 -04:00 committed by Matt Clay
parent c7eb08b217
commit 686026919e

View file

@ -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)