From 9a930fb481668cc7e1ac0b5b44eb97a92a8f31a7 Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Wed, 7 May 2014 09:59:13 -0500 Subject: [PATCH] Add pyc/pyo to ignore list for inventory directories Fixes #7308 --- lib/ansible/inventory/dir.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/lib/ansible/inventory/dir.py b/lib/ansible/inventory/dir.py index 46997d9be89..53a6349fc76 100644 --- a/lib/ansible/inventory/dir.py +++ b/lib/ansible/inventory/dir.py @@ -38,16 +38,11 @@ class InventoryDirectory(object): self.groups = {} for i in self.names: - - if i.endswith("~") or i.endswith(".orig") or i.endswith(".bak"): - continue - if i.endswith(".ini"): - # configuration file for an inventory script - continue - if i.endswith(".retry"): - # this file is generated on a failed playbook and should only be - # used when run specifically - continue + + # Skip files that end with certain extensions or characters + for ext in ("~", ".orig", ".bak", ".ini", ".retry", ".pyc", ".pyo"): + if i.endswith(ext): + continue # Skip hidden files if i.startswith('.') and not i.startswith('./'): continue