mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Make a particular error about an invalid include statement a bit clearer.
This commit is contained in:
parent
ffdca762fa
commit
2833f48ed3
1 changed files with 3 additions and 1 deletions
|
@ -103,7 +103,6 @@ class Play(object):
|
||||||
task_vars = self.vars.copy()
|
task_vars = self.vars.copy()
|
||||||
if 'include' in x:
|
if 'include' in x:
|
||||||
tokens = shlex.split(x['include'])
|
tokens = shlex.split(x['include'])
|
||||||
|
|
||||||
for t in tokens[1:]:
|
for t in tokens[1:]:
|
||||||
(k,v) = t.split("=", 1)
|
(k,v) = t.split("=", 1)
|
||||||
task_vars[k] = utils.template(v, task_vars)
|
task_vars[k] = utils.template(v, task_vars)
|
||||||
|
@ -113,6 +112,7 @@ class Play(object):
|
||||||
data = [x]
|
data = [x]
|
||||||
else:
|
else:
|
||||||
raise Exception("unexpected task type")
|
raise Exception("unexpected task type")
|
||||||
|
|
||||||
for y in data:
|
for y in data:
|
||||||
mv = task_vars.copy()
|
mv = task_vars.copy()
|
||||||
results.append(Task(self,y,module_vars=mv))
|
results.append(Task(self,y,module_vars=mv))
|
||||||
|
@ -151,6 +151,8 @@ class Play(object):
|
||||||
# translate a list of vars into a dict
|
# translate a list of vars into a dict
|
||||||
if type(self.vars) == list:
|
if type(self.vars) == list:
|
||||||
for item in self.vars:
|
for item in self.vars:
|
||||||
|
if getattr(item, 'items', None) is None:
|
||||||
|
raise errors.AnsibleError("expecting a key-value pair in 'vars' section")
|
||||||
k, v = item.items()[0]
|
k, v = item.items()[0]
|
||||||
vars[k] = v
|
vars[k] = v
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue