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
pull/15410/head
James Cammarata 9 years ago
parent fcd6d7010d
commit 30a38f94ce

@ -332,11 +332,15 @@ class Base:
if isinstance(value, string_types) and '%' in value: if isinstance(value, string_types) and '%' in value:
value = value.replace('%', '') value = value.replace('%', '')
value = float(value) value = float(value)
elif attribute.isa == 'list': elif attribute.isa in ('list', 'barelist'):
if value is None: if value is None:
value = [] value = []
elif not isinstance(value, list): 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(',') value = value.split(',')
else: else:
value = [ value ] value = [ value ]

Loading…
Cancel
Save