Made repo root available for templates
This allows for embedding the repo root inside of, for example, scripts to make them function properly no matter where they are run from.
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
ROOT=$(git rev-parse --show-toplevel)
|
ROOT={{ root }}
|
||||||
CONFIGS=${ROOT}/configs
|
CONFIGS=${ROOT}/configs
|
||||||
|
|
||||||
# Generate the configuration for each node
|
# Generate the configuration for each node
|
||||||
|
|||||||
@@ -152,7 +152,9 @@ def main():
|
|||||||
for template_name in TEMPLATES.list_templates():
|
for template_name in TEMPLATES.list_templates():
|
||||||
template = TEMPLATES.get_template(template_name)
|
template = TEMPLATES.get_template(template_name)
|
||||||
|
|
||||||
rendered = template.render(nodes=nodes, clusters=clusters, config=config)
|
rendered = template.render(
|
||||||
|
nodes=nodes, clusters=clusters, config=config, root=ROOT
|
||||||
|
)
|
||||||
with open(RENDERED.joinpath(template_name), "w") as f:
|
with open(RENDERED.joinpath(template_name), "w") as f:
|
||||||
f.write(rendered)
|
f.write(rendered)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user