|
|
|
@ -307,10 +307,19 @@ def ExpandTemplate(resource, imports, env, validate_schema=False):
|
|
|
|
|
source_file,
|
|
|
|
|
'Unable to find source file %s in imports.' % (source_file))
|
|
|
|
|
|
|
|
|
|
# source_file could be a short version of the template (say github short name)
|
|
|
|
|
# so we need to potentially map this into the fully resolvable name.
|
|
|
|
|
if 'path' in imports[source_file] and imports[source_file]['path']:
|
|
|
|
|
path = imports[source_file]['path']
|
|
|
|
|
if isinstance(imports[source_file], dict):
|
|
|
|
|
# This code path assumes a different structure for the 'imports' param.
|
|
|
|
|
# Map of String (name) to Dict ('path', 'content').
|
|
|
|
|
#
|
|
|
|
|
# source_file could be a short version of the template
|
|
|
|
|
# (say github short name)
|
|
|
|
|
# so we need to potentially map this into the fully resolvable name.
|
|
|
|
|
if 'path' in imports[source_file] and imports[source_file]['path']:
|
|
|
|
|
path = imports[source_file]['path']
|
|
|
|
|
content = imports[source_file]['content']
|
|
|
|
|
else:
|
|
|
|
|
path = source_file
|
|
|
|
|
content = imports[source_file]
|
|
|
|
|
|
|
|
|
|
resource['imports'] = SimpleImportMap(imports)
|
|
|
|
|
|
|
|
|
@ -332,11 +341,11 @@ def ExpandTemplate(resource, imports, env, validate_schema=False):
|
|
|
|
|
|
|
|
|
|
if path.endswith('jinja') or path.endswith('yaml'):
|
|
|
|
|
expanded_template = ExpandJinja(
|
|
|
|
|
source_file, imports[source_file]['content'], resource, imports)
|
|
|
|
|
source_file, content, resource, imports)
|
|
|
|
|
elif path.endswith('py'):
|
|
|
|
|
# This is a Python template.
|
|
|
|
|
expanded_template = ExpandPython(
|
|
|
|
|
imports[source_file]['content'], source_file, resource)
|
|
|
|
|
content, source_file, resource)
|
|
|
|
|
else:
|
|
|
|
|
# The source file is not a jinja file or a python file.
|
|
|
|
|
# This in fact should never happen due to the IsTemplate check above.
|
|
|
|
|