Fix custom output dir for templates processor

Templates processor fails to locate *.j2 files,
when a custom output dir is specified.

Ensure *.j2 templates are on their expected search
paths for upcoming pasring and rendering

Change-Id: Idbc93e27574c66a9a5a73e3fcd7e88647282f201
Closes-bug: #1748425
Signed-off-by: Bogdan Dobrelya <bdobreli@redhat.com>
This commit is contained in:
Bogdan Dobrelya 2018-02-09 14:48:30 +01:00
parent 4bef5bd4e4
commit e6946bc5f2

View File

@ -138,6 +138,12 @@ def process_templates(template_path, role_data_path, output_dir,
if not os.path.exists(out_dir):
os.mkdir(out_dir)
# Ensure template is on its expected search path
# for upcoming pasring and rendering
for f in files:
if f.endswith('.j2') and output_dir:
shutil.copy(os.path.join(subdir, f), out_dir)
for f in files:
file_path = os.path.join(subdir, f)
# We do three templating passes here: