mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-05 00:31:37 -07:00
Conditional bare: fix typos (#53807)
This commit is contained in:
parent
3b8768158f
commit
dbb782a594
3 changed files with 9 additions and 9 deletions
|
@ -319,14 +319,14 @@ COLOR_WARN:
|
||||||
env: [{name: ANSIBLE_COLOR_WARN}]
|
env: [{name: ANSIBLE_COLOR_WARN}]
|
||||||
ini:
|
ini:
|
||||||
- {key: warn, section: colors}
|
- {key: warn, section: colors}
|
||||||
CONDITINAL_BARE_VARS:
|
CONDITIONAL_BARE_VARS:
|
||||||
name: Allow bare variable evaluation in conditionals
|
name: Allow bare variable evaluation in conditionals
|
||||||
default: True
|
default: True
|
||||||
type: boolean
|
type: boolean
|
||||||
description:
|
description:
|
||||||
- With this setting on (True), runing conditional evaluation 'var' is treated differently 'var.subkey' as the first is evaluted
|
- With this setting on (True), running conditional evaluation 'var' is treated differently than 'var.subkey' as the first is evaluated
|
||||||
directly while the second goes though the Jinja2 parser. But 'false' strings in 'var' get evaluated as booleans.
|
directly while the second goes through the Jinja2 parser. But 'false' strings in 'var' get evaluated as booleans.
|
||||||
- With this settting off they both evalutate the same but in cases in which 'var' was 'false' (a string) it won't get evaluated as a boolean anymore.
|
- With this setting off they both evaluate the same but in cases in which 'var' was 'false' (a string) it won't get evaluated as a boolean anymore.
|
||||||
- Currently this setting defaults to 'True' but will soon change to 'False' and the setting itself will be removed in the future.
|
- Currently this setting defaults to 'True' but will soon change to 'False' and the setting itself will be removed in the future.
|
||||||
- Expect the default to change in version 2.10 and that this setting eventually will be deprecated after 2.12
|
- Expect the default to change in version 2.10 and that this setting eventually will be deprecated after 2.12
|
||||||
env: [{name: ANSIBLE_CONDITIONAL_BARE_VARS}]
|
env: [{name: ANSIBLE_CONDITIONAL_BARE_VARS}]
|
||||||
|
|
|
@ -114,7 +114,7 @@ class Conditional:
|
||||||
if isinstance(conditional, bool):
|
if isinstance(conditional, bool):
|
||||||
return conditional
|
return conditional
|
||||||
|
|
||||||
if C.CONDITINAL_BARE_VARS:
|
if C.CONDITIONAL_BARE_VARS:
|
||||||
if conditional in all_vars and VALID_VAR_REGEX.match(conditional):
|
if conditional in all_vars and VALID_VAR_REGEX.match(conditional):
|
||||||
display.deprecated('evaluating %s as a bare variable, this behaviour will go away and you might need to add |bool'
|
display.deprecated('evaluating %s as a bare variable, this behaviour will go away and you might need to add |bool'
|
||||||
' to the expression in the future. Also see CONDITIONAL_BARE_VARS configuration toggle.' % conditional, "2.12")
|
' to the expression in the future. Also see CONDITIONAL_BARE_VARS configuration toggle.' % conditional, "2.12")
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
vars_files:
|
vars_files:
|
||||||
- vars/main.yml
|
- vars/main.yml
|
||||||
tasks:
|
tasks:
|
||||||
- name: set conditial bare vars status
|
- name: set conditional bare vars status
|
||||||
set_fact:
|
set_fact:
|
||||||
bare: "{{lookup('config', 'CONDITINAL_BARE_VARS')|bool}}"
|
bare: "{{lookup('config', 'CONDITIONAL_BARE_VARS')|bool}}"
|
||||||
|
|
||||||
- name: test conditional '=='
|
- name: test conditional '=='
|
||||||
shell: echo 'testing'
|
shell: echo 'testing'
|
||||||
|
@ -536,14 +536,14 @@
|
||||||
- top is skipped
|
- top is skipped
|
||||||
- sub is skipped
|
- sub is skipped
|
||||||
|
|
||||||
- name: test that 'comparisson expression' item works with_items
|
- name: test that 'comparison expression' item works with_items
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- item
|
- item
|
||||||
with_items:
|
with_items:
|
||||||
- 1 == 1
|
- 1 == 1
|
||||||
|
|
||||||
- name: test that 'comparisson expression' item works in loop
|
- name: test that 'comparison expression' item works in loop
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- item
|
- item
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue