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
This commit is contained in:
James Cammarata 2016-04-22 14:19:36 -04:00
parent fcd6d7010d
commit 30a38f94ce

View file

@ -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 ]