If you are using GitLab outside of the ILL, then you will need to use HTTPS and not SSH for clone/push/pull operations. If you are using the VPN, then SSH will work normally.

...
 
Commits (3)
version 0.7.0
-------------
* CHANGED propagate the headless state to all children
* CHANGED better code for checking missing jinja 2 templates
version 0.6.0
-------------
* CHANGED existing templates are now skipped from packer run
......
......@@ -190,6 +190,7 @@ class PackerTemplate:
parent_builder["iso_url"] = os.path.join(builder["output_directory"],"{}-{}".format(parent_template.name, builder_name))
parent_builder["iso_checksum_type"] = "none"
parent_builder["iso_checksum_url"] = "none"
parent_builder["headless"] = "{{ headless }}"
self._builders.insert(0,parent_builder)
# If the builder is also defined in the child config, use the child config one and specify the image dependency
......@@ -202,6 +203,7 @@ class PackerTemplate:
builder["iso_url"] = os.path.join(self._templates_base_dir,parent_template.name,"builds","{}-{}".format(parent_template.name, builder_name))
builder["iso_checksum_type"] = "none"
builder["iso_checksum_url"] = "none"
builder["headless"] = "{{ headless }}"
def _load_packages(self, packages: List[str]):
"""Load the non-standard package YAML file and append them as provisioners of this :class:`PackerTemplate`.
......@@ -272,20 +274,23 @@ class PackerTemplate:
node["provisioners"] = self._provisioners
node["post-processors"] = self._postprocessors
env = jinja2.Environment(undefined=jinja2.DebugUndefined)
template = env.from_string(repr(node))
rendered = template.render(**self._environment)
stringified_node = repr(node)
# Create a jinja evironment for parsing the manifest
env = jinja2.Environment()
# Parse the string with jinja templates in unrendered state in order to get te set of all jinja templates
ast = env.parse(stringified_node)
jinja_templates = jinja2.meta.find_undeclared_variables(ast)
# Retrieve those templates which are not declared in the environment. These are the undefined templates.
undefined = jinja_templates.difference(self._environment.keys())
# Check if rendering was done correctly
ast = env.parse(rendered)
undefined = jinja2.meta.find_undeclared_variables(ast)
# If there are some undefined templates, stop here.
if undefined:
print(f'The following variables are undefined: {undefined!r}')
sys.exit(1)
# Replace back %< .* %> to {{ .* }}
rendered = rendered.replace("%<","{{")
rendered = rendered.replace(">%","}}")
template = env.from_string(stringified_node)
rendered = template.render(**self._environment)
# Dump to the output file
with open(output_file, "w") as fout:
......
......@@ -20,7 +20,7 @@ __status__ : str = "Prototype"
__url__ : str = "https://code.ill.fr/panosc/data-analysis-services/packme"
__version__ : str = "0.6.0"
__version__ : str = "0.7.0"
__long_description_content_type__ : str ="text/markdown"
......
......@@ -24,7 +24,7 @@ packer:
boot_wait: 5s
boot_command:
- "<tab> "
- "preseed/url=http://%< .HTTPIP >%:%< .HTTPPort >%/{{ preseed_file_name }} "
- "preseed/url=http://{% raw %}{{ .HTTPIP }}:{{ .HTTPPort }}{% endraw %}/{{ preseed_file_name }} "
- "auto-install/enable=true "
- "net.ifnames=0 "
- "netcfg/get_hostname={{ vm_name }} "
......@@ -38,7 +38,7 @@ packer:
- "passwd/user-password-again= {{ user_password }} "
- "passwd/root-password={{ root_password }} "
- "passwd/root-password-again={{ root_password }} "
- "no_proxy=%< .HTTPIP >%,{{ no_proxy }} "
- "no_proxy={% raw %}{{ .HTTPIP }}{% endraw %},{{ no_proxy }} "
- "<enter>"
disk_size: "{{ disk_size }}"
http_directory: "http"
......