Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

native types: literal_eval all the things #68938

Merged
merged 5 commits into from Apr 17, 2020

Conversation

mkrizek
Copy link
Contributor

@mkrizek mkrizek commented Apr 14, 2020

SUMMARY

With pallets/jinja#1190 merged our short-circuit
is no longer valid (has it ever been?) as now data like ' True ' may go
through our ansible_native_concat function as opposed to going through
intermediate call to Jinja2's native_concat before. Now we need to always
send data through literal_eval to ensure native types are returned.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

lib/ansible/template/native_helpers.py

With pallets/jinja#1190 merged our short-circuit
is no longer valid (has it ever been?) as now data like ' True ' may go
through our ansible_native_concat function as opposed to going through
intermediate call to Jinja2's native_concat before. Now we need to always
send data through literal_eval to ensure native types are returned.
@mkrizek mkrizek requested a review from jctanner April 14, 2020 13:58
@ansibot ansibot added affects_2.10 This issue/PR affects Ansible v2.10 bug This issue/PR relates to a bug. core_review In order to be merged, this PR must follow the core review workflow. needs_triage Needs a first human triage before being processed. small_patch support:community This issue/PR relates to code supported by the Ansible community. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Apr 14, 2020
@mkrizek
Copy link
Contributor Author

mkrizek commented Apr 14, 2020

@mattclay When distros update Jinja2 from 2.11.1 to 2.11.2 jinja2_native_types test target will fail. This is a fix for that so I suspect this would need to be backported to relevant branches once/if merged.

@ansibot

This comment has been minimized.

@ansibot ansibot added needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed core_review In order to be merged, this PR must follow the core review workflow. labels Apr 14, 2020
@mkrizek mkrizek added the native_jinja issues related to jinja native types label Apr 14, 2020
@ansibot ansibot added the test This PR relates to tests. label Apr 14, 2020
@ansibot ansibot added core_review In order to be merged, this PR must follow the core review workflow. and removed needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Apr 15, 2020
@mkrizek mkrizek merged commit acdc9eb into ansible:devel Apr 17, 2020
@mkrizek mkrizek deleted the native-types-short-circuit-fix branch April 17, 2020 12:59
@mkrizek mkrizek removed the needs_triage Needs a first human triage before being processed. label Apr 17, 2020
mkrizek added a commit to mkrizek/ansible that referenced this pull request Apr 20, 2020
With pallets/jinja#1190 merged our short-circuit
is no longer valid (has it ever been?) as now data like ' True ' may go
through our ansible_native_concat function as opposed to going through
intermediate call to Jinja2's native_concat before. Now we need to always
send data through literal_eval to ensure native types are returned.

(cherry picked from commit acdc9eb)
mkrizek added a commit to mkrizek/ansible that referenced this pull request Apr 20, 2020
With pallets/jinja#1190 merged our short-circuit
is no longer valid (has it ever been?) as now data like ' True ' may go
through our ansible_native_concat function as opposed to going through
intermediate call to Jinja2's native_concat before. Now we need to always
send data through literal_eval to ensure native types are returned.

(cherry picked from commit acdc9eb)
bcoca pushed a commit to bcoca/ansible that referenced this pull request Apr 22, 2020
With pallets/jinja#1190 merged our short-circuit
is no longer valid (has it ever been?) as now data like ' True ' may go
through our ansible_native_concat function as opposed to going through
intermediate call to Jinja2's native_concat before. Now we need to always
send data through literal_eval to ensure native types are returned.
bcoca pushed a commit to bcoca/ansible that referenced this pull request Apr 28, 2020
With pallets/jinja#1190 merged our short-circuit
is no longer valid (has it ever been?) as now data like ' True ' may go
through our ansible_native_concat function as opposed to going through
intermediate call to Jinja2's native_concat before. Now we need to always
send data through literal_eval to ensure native types are returned.
mattclay pushed a commit that referenced this pull request May 6, 2020
* native types: literal_eval all the things (#68938)

With pallets/jinja#1190 merged our short-circuit
is no longer valid (has it ever been?) as now data like ' True ' may go
through our ansible_native_concat function as opposed to going through
intermediate call to Jinja2's native_concat before. Now we need to always
send data through literal_eval to ensure native types are returned.

(cherry picked from commit acdc9eb)

* Fix tests
mattclay added a commit to mattclay/ansible that referenced this pull request May 7, 2020
mattclay added a commit that referenced this pull request May 8, 2020
@ansible ansible locked and limited conversation to collaborators May 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.10 This issue/PR affects Ansible v2.10 bug This issue/PR relates to a bug. core_review In order to be merged, this PR must follow the core review workflow. native_jinja issues related to jinja native types support:community This issue/PR relates to code supported by the Ansible community. support:core This issue/PR relates to code supported by the Ansible Engineering Team. test This PR relates to tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants