feat: update makejinja to 2.5.0 (#1221)

* feat: update makejinja to 2.5.0 and implement mjfilter

Signed-off-by: Devin Buhl <devin@buhl.casa>

* fix: move logic for skip tests

Signed-off-by: Devin Buhl <devin@buhl.casa>

* feat: update makejinja to 2.5.0

Signed-off-by: Devin Buhl <devin@buhl.casa>

---------

Signed-off-by: Devin Buhl <devin@buhl.casa>
This commit is contained in:
Devin Buhl authored and GitHub committed 2024-01-21 17:37:48 -05:00
1 parent 8265c80909
commit 4be97f78e8
4 files changed
+8 -9

No files matched your search

+1 -1
View File
@@ -67,7 +67,7 @@ tasks:
preconditions:
- { msg: "Missing virtual environment", sh: "test -d {{.ROOT_DIR}}/.venv" }
- { msg: "Missing Makejinja config file", sh: "test -f {{.MAKEJINJA_CONFIG_FILE}}" }
- { msg: "Missing Makejinja loader file", sh: "test -f {{.BOOTSTRAP_DIR}}/scripts/loader.py" }
- { msg: "Missing Makejinja plugin file", sh: "test -f {{.BOOTSTRAP_DIR}}/scripts/plugin.py" }
- { msg: "Missing bootstrap addons file", sh: "test -f {{.BOOTSTRAP_ADDONS_FILE}}" }
- { msg: "Missing bootstrap config file", sh: "test -f {{.BOOTSTRAP_CONFIG_FILE}}" }
@@ -1,4 +1,6 @@
from typing import Any
import bcrypt
import makejinja
import netaddr
import validation
@@ -16,12 +18,12 @@ def nthhost(value: str, query: int) -> str:
def encrypt(value: str) -> str:
return bcrypt.hashpw(value.encode(), bcrypt.gensalt(rounds=10)).decode("ascii")
class Loader:
def __init__(self, data):
class Plugin(makejinja.plugin.Plugin):
def __init__(self, data: dict[str, Any]):
if data.get("skip_tests", False):
return
validation.validate(data)
def filters(self):
def filters(self) -> makejinja.plugin.Filters:
return [nthhost, encrypt]
+1 -4
View File
@@ -4,7 +4,7 @@ output = "./"
exclude_patterns = ["*.partial.yaml.j2"]
data = ["./bootstrap/vars/addons.yaml", "./bootstrap/vars/config.yaml"]
import_paths = ["./bootstrap/scripts"]
loaders = ["loader:Loader"]
loaders = ["plugin:Plugin"]
jinja_suffix = ".j2"
force = true
undefined = "chainable"
@@ -19,6 +19,3 @@ comment_start = "#|"
comment_end = "|#"
variable_start = "#{"
variable_end = "}#"
[makejinja.whitespace]
keep_trailing_newline = true
+1 -1
View File
@@ -1,6 +1,6 @@
bcrypt==4.1.2
cloudflare==2.16.0
email-validator==2.1.0
makejinja==2.3.5
makejinja==2.5.0
netaddr==0.10.1
passlib==1.7.4