diff --git a/lib/ansible/inventory/expand_hosts.py b/lib/ansible/inventory/expand_hosts.py index a1db9f1c6a..b1cc0dcb82 100644 --- a/lib/ansible/inventory/expand_hosts.py +++ b/lib/ansible/inventory/expand_hosts.py @@ -41,10 +41,7 @@ def detect_range(line = None): Returnes True if the given line contains a pattern, else False. ''' - if (line.find("[") != -1 and - line.find(":") != -1 and - line.find("]") != -1 and - line.index("[") < line.index(":") < line.index("]")): + if 0 <= line.find("[") < line.find(":") < line.find("]"): return True else: return False