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,9 +40,8 @@ class InventoryDirectory(object):
for i in self.names: for i in self.names:
# Skip files that end with certain extensions or characters # Skip files that end with certain extensions or characters
for ext in ("~", ".orig", ".bak", ".ini", ".retry", ".pyc", ".pyo"): if any(i.endswith(ext) for ext in ("~", ".orig", ".bak", ".ini", ".retry", ".pyc", ".pyo")):
if i.endswith(ext): continue
continue
# Skip hidden files # Skip hidden files
if i.startswith('.') and not i.startswith('./'): if i.startswith('.') and not i.startswith('./'):
continue continue

@ -439,3 +439,7 @@ class TestInventory(unittest.TestCase):
actual_host_names = [host.name for host in group_greek] actual_host_names = [host.name for host in group_greek]
print "greek : %s " % actual_host_names print "greek : %s " % actual_host_names
assert actual_host_names == ['zeus', 'morpheus'] 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