Merge pull request #7412 from bellkev/fix_skip_dir_inventory_extensions

Fix skip dir inventory extensions
pull/7481/head
James Cammarata 11 years ago
commit 1f0be3753d

@ -40,8 +40,7 @@ class InventoryDirectory(object):
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):
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('./'):

@ -439,3 +439,7 @@ class TestInventory(unittest.TestCase):
actual_host_names = [host.name for host in group_greek]
print "greek : %s " % actual_host_names
assert actual_host_names == ['zeus', 'morpheus']
def test_dir_inventory_skip_extension(self):
inventory = self.dir_inventory()
assert 'skipme' not in [h.name for h in inventory.get_hosts()]

Loading…
Cancel
Save