Skip to content

Commit

Permalink
better error when wrong type passed to import_play (ansible#36592)
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoca authored Apr 12, 2018
1 parent d78da40 commit a4046d3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/ansible/playbook/playbook_include.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@

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
Expand Down Expand Up @@ -135,6 +135,8 @@ def _preprocess_import(self, ds, new_ds, k, v):

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
Expand Down

0 comments on commit a4046d3

Please sign in to comment.