From c4f1785217e0e000181df60847644b1d44163477 Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Tue, 23 Sep 2014 16:12:01 -0500 Subject: [PATCH] Use split_args instead of shlex to split include params Fixes #8947 --- lib/ansible/playbook/__init__.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/ansible/playbook/__init__.py b/lib/ansible/playbook/__init__.py index 4acb15a651f..58e2bafe18e 100644 --- a/lib/ansible/playbook/__init__.py +++ b/lib/ansible/playbook/__init__.py @@ -21,6 +21,7 @@ import ansible.runner from ansible.utils.template import template from ansible import utils from ansible import errors +from ansible.module_utils.splitter import split_args, unquote import ansible.callbacks import ansible.cache import os @@ -209,12 +210,15 @@ class PlayBook(object): name and returns the merged vars along with the path ''' new_vars = existing_vars.copy() - tokens = shlex.split(play_ds.get('include', '')) + tokens = split_args(play_ds.get('include', '')) for t in tokens[1:]: - (k,v) = t.split("=", 1) - new_vars[k] = template(basedir, v, new_vars) + try: + (k,v) = unquote(t).split("=", 1) + new_vars[k] = template(basedir, v, new_vars) + except ValueError, e: + raise errors.AnsibleError('included playbook variables must be in the form k=v, got: %s' % t) - return (new_vars, tokens[0]) + return (new_vars, unquote(tokens[0])) # *****************************************************