summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Martz <matt@sivel.net>2020-02-25 16:36:01 -0600
committerMatt Clay <matt@mystile.com>2020-03-02 14:31:55 -0800
commit6fc2ae7476bf1b8e61789843aae795b821d75857 (patch)
treec493b9aa0815553b1961356e392b863c7ed91483
parent0f7d62f6a531a8af135bca8aac27838c2847eb9e (diff)
downloadansible-6fc2ae7476bf1b8e61789843aae795b821d75857.tar.gz
[stable-2.9] Clean up CONDITIONAL_BARE_VARS warning. Fixes #67735 (#67751).
(cherry picked from commit 6e1a59174aba6bfe00c7b03a4287e784f802b2e8) Co-authored-by: Matt Martz <matt@sivel.net>
-rw-r--r--changelogs/fragments/67735-warning-cleanup.yml3
-rw-r--r--lib/ansible/playbook/conditional.py4
2 files changed, 5 insertions, 2 deletions
diff --git a/changelogs/fragments/67735-warning-cleanup.yml b/changelogs/fragments/67735-warning-cleanup.yml
new file mode 100644
index 0000000000..e170513c06
--- /dev/null
+++ b/changelogs/fragments/67735-warning-cleanup.yml
@@ -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)
diff --git a/lib/ansible/playbook/conditional.py b/lib/ansible/playbook/conditional.py
index 6c827e9d67..2fadf77487 100644
--- a/lib/ansible/playbook/conditional.py
+++ b/lib/ansible/playbook/conditional.py
@@ -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