Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ManuelSopenaBallesteros committed Jun 17, 2024
1 parent 7b44884 commit 9e282be
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions docs/cluster_mgmt_with_sat_file.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ session_templates:

### jinja2 template engine

While sat bootprep templating seems very simple, manta uses a jinja2 template engine.
While sat bootprep templating seems very simple, manta follows ansible approach and uses a jinja2 template engine.

???+ warning "Using `-` in variable names is not recommended"
A common mistake when dealing with jinja2 files is using `-` in variable names. This won't work since jinja will expand this as a math operator, to avoid this issue, try to use `_` instead.

eg:

When a jinja template engine sees this `{{ template-version }}` it will try to resolve template and version as 2 independent variables (variable `template` and variable `version`) and substrace them means. If those variables don't exists in the sessions var, then they will become `undefined` and the jinja template engine will try to substract the 2 undefined values `undefined - undefine`, then, the operation will fail. This however would work if the session vars contains:
When a jinja template engine sees this `{{ template-version }}` it will try to resolve `template-version` as a mathematical expression (substract) of 2 variables (variable `template` and variable `version`). If those variables don't exists in the sessions var, then they will become `undefined` and the jinja template engine will try to substract the 2 undefined values `undefined - undefine`, then, the operation will fail. This however would work if the session vars contains:

```bash
$ cat my_sat_vars.yml
Expand Down Expand Up @@ -94,7 +94,7 @@ configurations:
tag: v0.1.0

session_templates:
- name: "my_template_{{ template-version }}" # Won't work. Error when resolving `session-version` because `-` is a math operator. Don't use `-` in variable names
- name: "my-template-{{ template-version }}" # Won't work. Error when resolving `session-version` because `-` is a math operator. Don't use `-` in variable names
ims:
id: dbc5300c-3c98-4384-a7a7-28e628cbff43
configuration: "runtime_my_config_mc"
Expand Down Expand Up @@ -127,7 +127,7 @@ called `Result::unwrap()` on an `Err` value: Error { kind: InvalidOperation, det
10 | tag: {{test_layer.tag}}
11 |
12 | session_templates:
13 > - name: "my_template_{{ template-version }}" # Won't work. Error when resolving `session-version` because `-` is a math operator. Don't use `-` in variable names
13 > - name: "my-template-{{ template-version }}" # Won't work. Error when resolving `session-version` because `-` is a math operator. Don't use `-` in variable names
i ^^^^^^^^^^^^^^^^ invalid operation
14 | ims:
15 | id: dbc5300c-3c98-4384-a7a7-28e628cbff43
Expand Down

0 comments on commit 9e282be

Please sign in to comment.