better error when wrong type passed to import_play (#36592)
fixes #36576
This commit is contained in:
parent
d78da403b6
commit
a4046d3424
1 changed files with 4 additions and 2 deletions
|
@ -21,8 +21,8 @@ __metaclass__ = type
|
|||
|
||||
import os
|
||||
|
||||
from ansible.errors import AnsibleParserError, AnsibleError, AnsibleAssertionError
|
||||
from ansible.module_utils.six import iteritems
|
||||
from ansible.errors import AnsibleParserError, AnsibleAssertionError
|
||||
from ansible.module_utils.six import iteritems, string_types
|
||||
from ansible.parsing.splitter import split_args, parse_kv
|
||||
from ansible.parsing.yaml.objects import AnsibleBaseYAMLObject, AnsibleMapping
|
||||
from ansible.playbook.attribute import FieldAttribute
|
||||
|
@ -135,6 +135,8 @@ class PlaybookInclude(Base, Conditional, Taggable):
|
|||
|
||||
if v is None:
|
||||
raise AnsibleParserError("playbook import parameter is missing", obj=ds)
|
||||
elif not isinstance(v, string_types):
|
||||
raise AnsibleParserError("playbook import parameter must be a string indicating a file path, got %s instead" % type(v), obj=ds)
|
||||
|
||||
# The import_playbook line must include at least one item, which is the filename
|
||||
# to import. Anything after that should be regarded as a parameter to the import
|
||||
|
|
Loading…
Reference in a new issue