import_playbook - change additional params to deprecation (#72987)

* import_playbook - change additional params to deprecation

I incorrectly recommended this be set as a warning when it should have been a deprecation.

* Fix deprecation sanity test to not required a collection name when not inside a collection
pull/73017/head
Sam Doooran 4 years ago committed by GitHub
parent dbc2c996ab
commit 8e022ef00a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
bugfixes:
- import_playbook - change warning about extra parameters to deprecation (https://github.com/ansible/ansible/issues/72745)

@ -42,6 +42,10 @@ EXAMPLES = r'''
- name: Include a play after another play
import_playbook: otherplays.yaml
- name: Set variables on an imported playbook
import_playbook: otherplays.yml
vars:
service: httpd
- name: This DOES NOT WORK
hosts: all

@ -172,7 +172,8 @@ class PlaybookInclude(Base, Conditional, Taggable):
else:
new_ds['import_playbook'] = items[0].strip()
if len(items) > 1:
display.warning('Additional parameters in import_playbook statements are not supported. This will be an error in version 2.14')
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:]))

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

@ -242,7 +242,7 @@ class AnsibleDeprecatedChecker(BaseChecker):
this_collection = collection_name == (self.collection_name or 'ansible.builtin')
if not this_collection:
self.add_message('wrong-collection-deprecated', node=node, args=(collection_name,))
else:
elif self.collection_name is not None:
self.add_message('ansible-deprecated-no-collection-name', node=node)
if date:

Loading…
Cancel
Save