From 30a38f94ce81314019fb2d9496602eef0a5b36fe Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Fri, 22 Apr 2016 14:19:36 -0400 Subject: [PATCH] Create a special class of list FieldAttribute for splitting on commas Which we're use on a case-by-case basis if we find people were actually using comma-separated strings for list values outside of hosts. Support for doing so is now deprecated and users should instead use the full YAML syntax for lists of values. Fixes #15291 --- lib/ansible/playbook/base.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/ansible/playbook/base.py b/lib/ansible/playbook/base.py index 7acd6e160e..ad7328d347 100644 --- a/lib/ansible/playbook/base.py +++ b/lib/ansible/playbook/base.py @@ -332,11 +332,15 @@ class Base: if isinstance(value, string_types) and '%' in value: value = value.replace('%', '') value = float(value) - elif attribute.isa == 'list': + elif attribute.isa in ('list', 'barelist'): if value is None: value = [] elif not isinstance(value, list): - if isinstance(value, string_types): + if isinstance(value, string_types) and attribute.isa == 'barelist': + display.deprecated( + "Using comma separated values for a list has been deprecated. " \ + "You should instead use the correct YAML syntax for lists. " \ + ) value = value.split(',') else: value = [ value ]