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

minor fixes to playbook imports (#28422)

* minor fixes to playbook imports

* updated per feedback
This commit is contained in:
Brian Coca 2017-08-29 09:46:48 -04:00 committed by GitHub
parent 94707d03e8
commit 4f6b270620

View file

@ -89,14 +89,15 @@ class Playbook:
self._loader.set_basedir(cur_basedir) 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 a valid play or an include statement", obj=entry)
if 'include' in entry or 'import_playbook' in entry: if any(action in entry for action in ('import_playbook', 'include')):
if 'include' in entry: if 'include' in entry:
display.deprecated("You should use 'import_playbook' instead of 'include' for playbook includes") display.deprecated("'include' for playbook includes. You should use 'import_playbook' instead", version="2.8")
pb = PlaybookInclude.load(entry, basedir=self._basedir, variable_manager=variable_manager, loader=self._loader) pb = PlaybookInclude.load(entry, basedir=self._basedir, variable_manager=variable_manager, loader=self._loader)
if pb is not None: if pb is not None:
self._entries.extend(pb._entries) self._entries.extend(pb._entries)
else: else:
display.display("skipping playbook include '%s' due to conditional test failure" % entry.get('include', entry), color=C.COLOR_SKIP) which = entry.get('import_playbook', entry.get('include', entry))
display.display("skipping playbook '%s' due to conditional test failure" % which, color=C.COLOR_SKIP)
else: else:
entry_obj = Play.load(entry, variable_manager=variable_manager, loader=self._loader) entry_obj = Play.load(entry, variable_manager=variable_manager, loader=self._loader)
self._entries.append(entry_obj) self._entries.append(entry_obj)