mirror of https://github.com/ansible/ansible.git
[conditional] Remove support for bare variables (#74208)
Change: - Variables used in ``when`` conditionals are no longer parsed and attempted to be converted to booleans. All non-empty strings are considered true (empty strings, false). Test Plan: - Updated existing tests - Added a bunch of new tests with various kinds of truthy/falsy values. Tickets: - Fixes #74134 Signed-off-by: Rick Elrod <rick@elrod.me>pull/70819/merge
parent
ce96591313
commit
19aeb4706d
@ -0,0 +1,2 @@
|
||||
breaking_changes:
|
||||
- conditionals - ``when`` conditionals no longer automatically parse string booleans such as ``"true"`` and ``"false"`` into actual booleans. Any non-empty string is now considered true. The ``CONDITIONAL_BARE_VARS`` configuration variable no longer has any effect.
|
@ -1,18 +0,0 @@
|
||||
- hosts: testhost
|
||||
gather_facts: false
|
||||
vars:
|
||||
boolean_var: false
|
||||
nested:
|
||||
bool_var: false
|
||||
tasks:
|
||||
- name: Run tasks with previous warnings requesting the bool filter on type boolean vars
|
||||
block:
|
||||
- debug:
|
||||
when: boolean_var
|
||||
- debug:
|
||||
when: nested.bool_var
|
||||
- debug:
|
||||
when: double_interpolated
|
||||
vars:
|
||||
double_interpolated: "{{ other }}"
|
||||
other: false
|
@ -1,14 +0,0 @@
|
||||
- hosts: testhost
|
||||
gather_facts: false
|
||||
vars:
|
||||
str_boolean_var: 'false'
|
||||
tasks:
|
||||
- name: Run tasks with warnings for conditionals that will change in behavior depending on CONDITIONAL_BARE_VARS
|
||||
block:
|
||||
- debug:
|
||||
when: str_boolean_var
|
||||
- debug:
|
||||
when: double_interpolated
|
||||
vars:
|
||||
double_interpolated: other
|
||||
other: false
|
Loading…
Reference in New Issue