Skip to content

Commit

Permalink
Use split_args instead of shlex to split include params
Browse files Browse the repository at this point in the history
  • Loading branch information
jimi-c committed Sep 23, 2014
1 parent 4e9c061 commit c4f1785
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/ansible/playbook/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
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
Expand Down Expand Up @@ -209,12 +210,15 @@ def _get_include_info(self, play_ds, basedir, existing_vars={}):
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]))

# *****************************************************

Expand Down

0 comments on commit c4f1785

Please sign in to comment.