From 987265a6ef920466b44625097ff85f3e845dc8ea Mon Sep 17 00:00:00 2001 From: Sam Doran Date: Fri, 20 Sep 2019 16:03:51 -0400 Subject: Account for empty strings when splitting the host pattern (#62442) Improve tests - add more unit test cases - add specific integration test with more cases Testing shows no major downside to calling .strip() twice in a comprehension vs. using a regular for loop and only calling .strip() once. Going with the comprehension for ease of maintenance and because comprehensions are optimized in CPython. --- lib/ansible/inventory/manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/ansible/inventory') diff --git a/lib/ansible/inventory/manager.py b/lib/ansible/inventory/manager.py index 14e61ba933..72ffa6c8d7 100644 --- a/lib/ansible/inventory/manager.py +++ b/lib/ansible/inventory/manager.py @@ -130,7 +130,7 @@ def split_host_pattern(pattern): '''), pattern, re.X ) - return [p.strip() for p in patterns] + return [p.strip() for p in patterns if p.strip()] class InventoryManager(object): -- cgit v1.2.1