diff options
author | Jenkins <jenkins@review.openstack.org> | 2017-07-05 00:41:16 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2017-07-05 00:41:17 +0000 |
commit | a93c10bb93c2c6c2f71b90b5ed114d06ff1cf5b4 (patch) | |
tree | cc38587292bdaeb98f1b1cd2471232b302f1e34c /tools | |
parent | 082851723bf7726b5eecdb23b68a64f6269348cb (diff) | |
parent | 6a2f8bd5020be473c606383d163f24968ecb8139 (diff) |
Merge "Convert role templates to consume roles_data map"
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/process-templates.py | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/tools/process-templates.py b/tools/process-templates.py index 69ed96a6..c7d5ed9e 100755 --- a/tools/process-templates.py +++ b/tools/process-templates.py @@ -138,19 +138,31 @@ def process_templates(template_path, role_data_path, output_dir, print("jinja2 rendering roles %s" % "," .join(role_names)) for role in role_names: - j2_data = {'role': role} - # (dprince) For the undercloud installer we don't - # want to have heat check nova/glance API's - if r_map[role].get('disable_constraints', False): - j2_data['disable_constraints'] = True + j2_data = {'role': r_map[role]} out_f = "-".join( [role.lower(), os.path.basename(f).replace('.role.j2.yaml', '.yaml')]) out_f_path = os.path.join(out_dir, out_f) if not (out_f_path in excl_templates): - _j2_render_to_file(template_data, j2_data, - out_f_path, overwrite) + if '{{role.name}}' in template_data: + j2_data = {'role': r_map[role]} + _j2_render_to_file(template_data, j2_data, + out_f_path, overwrite) + else: + # Backwards compatibility with templates + # that specify {{role}} vs {{role.name}} + j2_data = {'role': role} + # (dprince) For the undercloud installer we + # don'twant to have heat check nova/glance + # API's + if r_map[role].get('disable_constraints', + False): + j2_data['disable_constraints'] = True + _j2_render_to_file( + template_data,j2_data, + out_f_path, overwrite) + else: print('skipping rendering of %s' % out_f_path) elif f.endswith('.j2.yaml'): |