1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-07-07 11:08:59 +00:00

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

@ -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