From ab8bacdf5e28dd029582c6359ac1d0a68d7a62fe Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Fri, 20 Oct 2017 11:52:34 -0400 Subject: [PATCH] make sure patterns are strings fixes #31978 --- lib/ansible/inventory/manager.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/ansible/inventory/manager.py b/lib/ansible/inventory/manager.py index c1aaebda18..4b5c0d7cb8 100644 --- a/lib/ansible/inventory/manager.py +++ b/lib/ansible/inventory/manager.py @@ -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