1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Raise an error if an action doesn't have a string type

Happens with e.g. "command: true" that YAML helpfully converts to a
bool.
This commit is contained in:
Daniel Hokka Zakrisson 2013-02-06 16:41:34 +01:00
parent 924e9ffe8b
commit d5e63332fe

View file

@ -47,6 +47,8 @@ class Task(object):
if x in utils.plugins.module_finder:
if 'action' in ds:
raise errors.AnsibleError("multiple actions specified in task %s" % (ds.get('name', ds['action'])))
if not isinstance(ds[x], basestring):
raise errors.AnsibleError("action specified for task %s has invalid type %s" % (ds.get('name', "%s: %s" % (x, ds[x])), type(ds[x])))
ds['action'] = x + " " + ds[x]
ds.pop(x)