import_playbook: remove deprecated free form params (#77431)

pull/77439/head
Martin Krizek 3 years ago committed by GitHub
parent eeef3110b2
commit 26149c45df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
removed_features:
- import_playbook - remove deprecated functionality that allows providing additional parameters in free form

@ -158,7 +158,6 @@ class PlaybookInclude(Base, Conditional, Taggable):
'''
Splits the playbook import line up into filename and parameters
'''
if v is None:
raise AnsibleParserError("playbook import parameter is missing", obj=ds)
elif not isinstance(v, string_types):
@ -169,16 +168,5 @@ class PlaybookInclude(Base, Conditional, Taggable):
items = split_args(v)
if len(items) == 0:
raise AnsibleParserError("import_playbook statements must specify the file name to import", obj=ds)
else:
new_ds['import_playbook'] = items[0].strip()
if len(items) > 1:
display.deprecated("Additional parameters in import_playbook statements are deprecated. "
"Use 'vars' instead. See 'import_playbook' documentation for examples.", version='2.14')
# rejoin the parameter portion of the arguments and
# then use parse_kv() to get a dict of params back
params = parse_kv(" ".join(items[1:]))
if 'tags' in params:
new_ds['tags'] = params.pop('tags')
if 'vars' in new_ds:
raise AnsibleParserError("import_playbook parameters cannot be mixed with 'vars' entries for import statements", obj=ds)
new_ds['vars'] = params
new_ds['import_playbook'] = items[0].strip()

@ -1,11 +1,7 @@
# Test that additional parameters after import_playbook raises a warning & strips whitespaces
- import_playbook: playbook1.yml tags=test_import
# Test and validate playbook import
- import_playbook: playbook1.yml
- import_playbook: validate1.yml
# Test and validate conditional import
- import_playbook: playbook2.yml
when: no

@ -17,7 +17,7 @@ ansible -m include_role -a name=role1 localhost
## Import (static)
# Playbook
test "$(ANSIBLE_DEPRECATION_WARNINGS=1 ansible-playbook -i ../../inventory playbook/test_import_playbook.yml "$@" 2>&1 | grep -c '\[DEPRECATION WARNING\]: Additional parameters in import_playbook')" = 1
ansible-playbook playbook/test_import_playbook.yml -i inventory "$@"
ANSIBLE_STRATEGY='linear' ansible-playbook playbook/test_import_playbook_tags.yml -i inventory "$@" --tags canary1,canary22,validate --skip-tags skipme

@ -1,4 +1,7 @@
- import_playbook: test_includes2.yml parameter1=asdf parameter2=jkl
- import_playbook: test_includes2.yml
vars:
parameter1: asdf
parameter2: jkl
- import_playbook: test_includes3.yml

Loading…
Cancel
Save