mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
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:
parent
fcd6d7010d
commit
30a38f94ce
1 changed files with 6 additions and 2 deletions
|
@ -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 ]
|
||||
|
|
Loading…
Reference in a new issue