[stable-2.10] import_playbook - change additional params to deprecation (#72987) (#73015)

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
(cherry picked from commit 8e022ef00a)

Co-authored-by: Sam Doooran <sdoran@redhat.com>
This commit is contained in:
Sam Doran 2021-02-07 01:52:15 -05:00 committed by GitHub
parent 3eafe0f255
commit e9c6b382ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 12 additions and 3 deletions

View file

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

View file

@ -0,0 +1,2 @@
bugfixes:
- ansble-test - only require a collection name in deprecation warnings when necessary (https://github.com/ansible/ansible/pull/72987)

View file

@ -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

View file

@ -150,7 +150,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:]))

View file

@ -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

View file

@ -233,7 +233,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: