diff options
author | Sam Doran <sdoran@redhat.com> | 2019-09-20 16:03:51 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-20 16:03:51 -0400 |
commit | 987265a6ef920466b44625097ff85f3e845dc8ea (patch) | |
tree | de0ee35897219f38e25190a59e57b267a7110fd4 /lib/ansible/inventory | |
parent | 8d0c193b251051e459513614e6f7212ecf9f0922 (diff) | |
download | ansible-987265a6ef920466b44625097ff85f3e845dc8ea.tar.gz |
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.
Diffstat (limited to 'lib/ansible/inventory')
-rw-r--r-- | lib/ansible/inventory/manager.py | 2 |
1 files changed, 1 insertions, 1 deletions
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): |