Clean up CONDITIONAL_BARE_VARS warning. Fixes #67735 (#67751)

This commit is contained in:
Matt Martz 2020-02-25 16:36:01 -06:00 committed by GitHub
parent 370f788731
commit 6e1a59174a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -0,0 +1,3 @@
bugfixes:
- Update the warning message for ``CONDITIONAL_BARE_VARS`` to list the original conditional
not the value of the original conditional (https://github.com/ansible/ansible/issues/67735)

View file

@ -133,8 +133,8 @@ class Conditional:
disable_lookups = hasattr(conditional, '__UNSAFE__')
conditional = templar.template(conditional, disable_lookups=disable_lookups)
if bare_vars_warning and not isinstance(conditional, 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")
display.deprecated('evaluating %r 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' % original, "2.12")
if not isinstance(conditional, text_type) or conditional == "":
return conditional