Merge pull request #7412 from bellkev/fix_skip_dir_inventory_extensions
Fix skip dir inventory extensions
This commit is contained in:
commit
1f0be3753d
3 changed files with 9 additions and 4 deletions
|
@ -40,8 +40,7 @@ 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('./'):
|
||||||
|
|
|
@ -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()]
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
[skip]
|
||||||
|
skipme
|
Loading…
Reference in a new issue