Skip to content

Commit

Permalink
refactor(tera): Change Jinja2 engine for minijinja
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Gil <[email protected]>
  • Loading branch information
pando85 committed Aug 9, 2024
1 parent c1e4575 commit ffbcb78
Show file tree
Hide file tree
Showing 26 changed files with 546 additions and 527 deletions.
169 changes: 76 additions & 93 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/builtins.rh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
uid: {{ rash.user.uid }}
gid: {{ rash.user.gid }}
dest: "{% if rash.user.uid != 0 %}/tmp{% endif %}/user_info"
mode: "{{ env.FILE_MODE | default(value='400') }}"
mode: "{{ env.FILE_MODE | default('400') }}"

4 changes: 2 additions & 2 deletions examples/copy.rh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@

- copy:
src: "{{ item }}"
dest: "{{ dest }}/{{ item | split(pat='/') | last }}"
dest: "{{ dest }}/{{ item | split('/') | last }}"
mode: "{{ options.mode }}"
loop: "{{ source | default (value=[]) }}"
loop: "{{ source | default([]) }}"
2 changes: 1 addition & 1 deletion examples/pacman.rh
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
register: packages

- debug:
msg: "{{ packages.extra | json_encode }}"
msg: "{{ packages.extra }}"
6 changes: 3 additions & 3 deletions examples/recursivity.rh
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
- name: user "{{ env.USER }}" loves
debug:
msg: |
"My favorite browser is {{ env.BROWSER | split(pat="/") | last | capitalize }}"
when: env | get(key="BROWSER")
"My favorite browser is {{ env.BROWSER | split("/") | last | capitalize }}"
when: "'BROWSER' in env"

- command:
cmd: "pwd"
chdir: "{{ env.HOME }}"
transfer_pid: true
when: env | get(key="MY_PASSWORD")
when: "'MY_PASSWORD' in env"

- name: last command must send with transfer_pid to let it as PID 1
command:
Expand Down
2 changes: 1 addition & 1 deletion examples/register.rh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@

- name: files in directory
debug:
var: item | replace(from=rash.dir, to='.')
var: item | replace(rash.dir, '.')
loop: "{{ find_result.extra }}"
4 changes: 2 additions & 2 deletions examples/task.rh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
dest: "/tmp/MY_PASSWORD_FILE_{{ file_name }}"
mode: "400"
vars:
file_name: "{{ item | split(pat='/') | last }}"
file_name: "{{ item | split('/') | last }}"
loop: "{{ find_result.extra }}"
when: env | get(key="MY_PASSWORD")
when: "'MY_PASSWORD' in env"
register: save_passwords_result
7 changes: 3 additions & 4 deletions rash_core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ serde_json.workspace = true
serde_yaml.workspace = true
byte-unit = "5.1.4"
console = "0.15.8"
minijinja = { version = "2.1.2", features = ["loader"]}
clap = { workspace = true, features = ["std", "color", "derive", "cargo"]}
exec = "0.3.1"
fern = { version = "0.6.2", features = ["colored"] }
ignore = "0.4.22"
# memfd could be added but brakes compatibility with kernels < 3.17
# ipc-channel = { version = "0.17", features = ["memfd"] }
ipc-channel = "0.18"
# memfd brakes compatibility with kernels < 3.17
ipc-channel = { version = "0.18", features = ["memfd"] }
itertools = "0.13.0"
nix = { version = "0.29", features = ["process", "user"] }
serde = { version = "1.0.200", features = ["derive"] }
Expand All @@ -46,7 +46,6 @@ similar = { version = "2.5", features = ["inline"] }
strum = "0.26.2"
strum_macros = "0.26.2"
tempfile = "3.10.1"
tera = { version = "1.19.1", default-features = false }
term_size = "1.0.0-beta.2"

[dev-dependencies]
Expand Down
Loading

0 comments on commit ffbcb78

Please sign in to comment.