diff options
Diffstat (limited to 'lib/ansible/playbook')
-rw-r--r-- | lib/ansible/playbook/__init__.py | 13 | ||||
-rw-r--r-- | lib/ansible/playbook/playbook_include.py | 2 |
2 files changed, 6 insertions, 9 deletions
diff --git a/lib/ansible/playbook/__init__.py b/lib/ansible/playbook/__init__.py index 8c4ed65f0b..0dbb38e43b 100644 --- a/lib/ansible/playbook/__init__.py +++ b/lib/ansible/playbook/__init__.py @@ -79,8 +79,8 @@ class Playbook: self._loader.set_basedir(cur_basedir) raise AnsibleParserError("A playbook must be a list of plays, got a %s instead" % type(ds), obj=ds) elif not ds: - display.deprecated("Empty plays will currently be skipped, in the future they will cause a syntax error", - version='2.12', collection_name='ansible.builtin') + self._loader.set_basedir(cur_basedir) + raise AnsibleParserError("A playbook must contain at least one play") # Parse the playbook entries. For plays, we simply parse them # using the Play() object, and includes are parsed using the @@ -89,18 +89,15 @@ class Playbook: if not isinstance(entry, dict): # restore the basedir in case this error is caught and handled self._loader.set_basedir(cur_basedir) - raise AnsibleParserError("playbook entries must be either a valid play or an include statement", obj=entry) + raise AnsibleParserError("playbook entries must be either valid plays or 'import_playbook' statements", obj=entry) - if any(action in entry for action in C._ACTION_ALL_IMPORT_PLAYBOOKS): - if any(action in entry for action in C._ACTION_INCLUDE): - display.deprecated("'include' for playbook includes. You should use 'import_playbook' instead", - version="2.12", collection_name='ansible.builtin') + if any(action in entry for action in C._ACTION_IMPORT_PLAYBOOK): pb = PlaybookInclude.load(entry, basedir=self._basedir, variable_manager=variable_manager, loader=self._loader) if pb is not None: self._entries.extend(pb._entries) else: which = entry - for k in C._ACTION_IMPORT_PLAYBOOK + C._ACTION_INCLUDE: + for k in C._ACTION_IMPORT_PLAYBOOK: if k in entry: which = entry[k] break diff --git a/lib/ansible/playbook/playbook_include.py b/lib/ansible/playbook/playbook_include.py index 5b96690255..d65f7966f3 100644 --- a/lib/ansible/playbook/playbook_include.py +++ b/lib/ansible/playbook/playbook_include.py @@ -140,7 +140,7 @@ class PlaybookInclude(Base, Conditional, Taggable): new_ds.ansible_pos = ds.ansible_pos for (k, v) in iteritems(ds): - if k in C._ACTION_ALL_IMPORT_PLAYBOOKS: + if k in C._ACTION_IMPORT_PLAYBOOK: self._preprocess_import(ds, new_ds, k, v) else: # some basic error checking, to make sure vars are properly |