Commit 0fcfc5cb authored by Eric Pellegrini's avatar Eric Pellegrini
Browse files

reformatted the output for missing templates

the environment can now also be stored in the manifest.yml file (least preceedence)
parent 601b4817
......@@ -19,11 +19,14 @@ from packme import Packman, __version__
class NotSudo(Exception):
def clean_templates_dir(templates_base_dir: str):
def clean_templates_dir(templates_base_dir: str = None):
"""Removes all manifest.json files, packer_cache and builds directories found in
templates directory
if templates_base_dir is None:
templates_base_dir = "templates"
template_dirs = glob.glob(os.path.join(templates_base_dir,"*"))
for template_dir in template_dirs:
......@@ -29,8 +29,14 @@ class PackerTemplate:
self._packages_base_dir = packages_base_dir
self._templates_base_dir = templates_base_dir
# First check whether the manifest contains an environment section
self._environment = yaml_node.get("environment", {})
# Then update this environment with the one found in environment.yml file
environment_file = os.path.join(self._templates_base_dir,self._name,"environment.yml")
# Finally take the global environment as the one with highest precedence
# Fetch the 'packer' node
......@@ -284,7 +290,7 @@ class PackerTemplate:
# If there are some undefined templates, stop here.
if undefined:
print(f'The following variables are undefined: {undefined!r}')
print(f'The following templates could not rendered: {sorted(undefined)!r}')
template = env.from_string(stringified_node)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment