1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

make sure patterns are strings

fixes #31978
This commit is contained in:
Brian Coca 2017-10-20 11:52:34 -04:00 committed by Brian Coca
parent 08fcf0346b
commit ab8bacdf5e

View file

@ -87,11 +87,12 @@ def split_host_pattern(pattern):
if isinstance(pattern, list):
return list(itertools.chain(*map(split_host_pattern, pattern)))
elif not isinstance(pattern, string_types):
pattern = to_native(pattern)
# If it's got commas in it, we'll treat it as a straightforward
# comma-separated list of patterns.
elif ',' in pattern:
if ',' in pattern:
patterns = re.split('\s*,\s*', pattern)
# If it doesn't, it could still be a single pattern. This accounts for