From 2432b45eb1e081bbc58ba1c04e6b75f58e92b31d Mon Sep 17 00:00:00 2001 From: Kevin Bell Date: Wed, 14 May 2014 23:32:53 -0700 Subject: [PATCH] Fixed extension filtering in InventoryDirectory --- lib/ansible/inventory/dir.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/ansible/inventory/dir.py b/lib/ansible/inventory/dir.py index 53a6349fc76..e3eda226958 100644 --- a/lib/ansible/inventory/dir.py +++ b/lib/ansible/inventory/dir.py @@ -36,13 +36,12 @@ class InventoryDirectory(object): self.parsers = [] self.hosts = {} self.groups = {} - + for i in self.names: # Skip files that end with certain extensions or characters - for ext in ("~", ".orig", ".bak", ".ini", ".retry", ".pyc", ".pyo"): - if i.endswith(ext): - continue + if any(i.endswith(ext) for ext in ("~", ".orig", ".bak", ".ini", ".retry", ".pyc", ".pyo")): + continue # Skip hidden files if i.startswith('.') and not i.startswith('./'): continue