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