Closed sivel closed 6 years ago
I'd like to see a playbook modernisation script which does things like:
and all similar things. This will make it less likely that people get stuck behind on older Ansible versions.
This is tentatively approved. @thaumos will talk to "the business" about this change.
I'd like to see a playbook modernisation script which does things like:
I may do something similar to fix the integration tests, I'll see what comes of it.
I say let's go ahead with the 2.9 removal of this. 4 versions is more than enough time to get people to Do The Right Thing™.
@sivel mentioned his script to fix the integration tests as a thing customer's use; this will be helpful for support (cc @michelleperz) to use as well! I'll make sure they see it.
This has been completed, but will require that we run python hacking/fix_test_syntax.py .
from time to time to ensure we are updating our integration tests after merging older PRs.
I've just submitted a new PR for recent changes in https://github.com/ansible/ansible/pull/33346
I'm going to go ahead and close this as the PR to implement this deprecation is merged.
Proposal: Deprecate using jinja tests as filters
Author: Matt Martz <@sivel>
Date: 2017/10/20
Motivation
Historically we did not expose jinja tests in ansible. As such everything was a filter. Eventually we began exposing certain things as tests, but we kept also registering them as filters to avoid backwards incompatible issues.
Unfortunately we continue to conflate the ideas. People don't understand they are different, they don't know to look on a different docs page for tests. To them they are all just filters.
This also causes problems when you want to use a filter that accepts a test as an argument such as (this example is contrived):
The docs for
selectattr
read:Due to our continued conflation of tests and filters, users are going to continue to be confused, and not understand what they can and cannot use where.
Problems
I describe the potential problems this solves above, but it does potentially create problems.
This will add a warning to every use of things like:
So this will cause some "headaches" for users, and potentially complaints that come through via issues and emails. However we can make it better by helping the users more in the deprecation warning:
Solution proposal
Templar._get_filters
iterate through the results ofTemplate._get_tests
and wrap all of the test functions with the above mentioned closureDependencies (optional)
N/A
Testing (optional)
Some tests should be created for this.
Documentation (optional)
Throughout the documentation, we will need to convert our use of tests as filters to correct test syntax. Additionally some notes about the change should be included.
Anything else?
I already have a branch with this implemented, it's just not pushed, and no PR opened yet. I can do this easily enough if it's warranted.