mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
parent
1ff331e66a
commit
2d01966e87
1 changed files with 6 additions and 3 deletions
|
@ -79,10 +79,13 @@ class Playbook:
|
||||||
except UnicodeDecodeError as e:
|
except UnicodeDecodeError as e:
|
||||||
raise AnsibleParserError("Could not read playbook (%s) due to encoding issues: %s" % (file_name, to_native(e)))
|
raise AnsibleParserError("Could not read playbook (%s) due to encoding issues: %s" % (file_name, to_native(e)))
|
||||||
|
|
||||||
if not isinstance(ds, list):
|
# check for errors and restore the basedir in case this error is caught and handled
|
||||||
# restore the basedir in case this error is caught and handled
|
if not ds:
|
||||||
self._loader.set_basedir(cur_basedir)
|
self._loader.set_basedir(cur_basedir)
|
||||||
raise AnsibleParserError("playbooks must be a list of plays", obj=ds)
|
raise AnsibleParserError("Empty playbook, nothing to do", obj=ds)
|
||||||
|
elif not isinstance(ds, list):
|
||||||
|
self._loader.set_basedir(cur_basedir)
|
||||||
|
raise AnsibleParserError("A playbook must be a list of plays, got a %s instead" % type(ds), obj=ds)
|
||||||
|
|
||||||
# Parse the playbook entries. For plays, we simply parse them
|
# Parse the playbook entries. For plays, we simply parse them
|
||||||
# using the Play() object, and includes are parsed using the
|
# using the Play() object, and includes are parsed using the
|
||||||
|
|
Loading…
Reference in a new issue