Merge pull request #7412 from bellkev/fix_skip_dir_inventory_extensions

Fix skip dir inventory extensions
This commit is contained in:
James Cammarata 2014-05-19 23:14:22 -05:00
commit 1f0be3753d
3 changed files with 9 additions and 4 deletions

View file

@ -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('./'):

View file

@ -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()]

View file

@ -0,0 +1,2 @@
[skip]
skipme