aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2017-01-23 18:53:07 +0000
committerGerrit Code Review <review@openstack.org>2017-01-23 18:53:07 +0000
commit1867b5408602813709359b5a34a1e7ea73ae7569 (patch)
tree8fffca03cff23444c31faf515a9ab512939fa50e
parent9a519142262f250a2851757a9c10956bab76e5ff (diff)
parent5fbe0c5249d89927fe195581f8c3591df03043ac (diff)
Merge "Ignore hidden files in directories"
-rwxr-xr-xtools/process-templates.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/process-templates.py b/tools/process-templates.py
index 9a06812b..381214be 100755
--- a/tools/process-templates.py
+++ b/tools/process-templates.py
@@ -78,6 +78,18 @@ def process_templates(template_path, role_data_path, overwrite):
if os.path.isdir(template_path):
for subdir, dirs, files in os.walk(template_path):
+
+ # NOTE(flaper87): Ignore hidden dirs as we don't
+ # generate templates for those.
+ # Note the slice assigment for `dirs` is necessary
+ # because we need to modify the *elements* in the
+ # dirs list rather than the reference to the list.
+ # This way we'll make sure os.walk will iterate over
+ # the shrunk list. os.walk doesn't have an API for
+ # filtering dirs at this point.
+ dirs[:] = [d for d in dirs if not d[0] == '.']
+ files = [f for f in files if not f[0] == '.']
+
for f in files:
file_path = os.path.join(subdir, f)
# We do two templating passes here: