fix: migrate to new Jinja2 V3 context decorator
This commit is contained in:
parent
4abed82b8a
commit
6f31560262
2
Makefile
2
Makefile
@ -36,7 +36,7 @@ upload: $(PACKAGE_FILE)
|
|||||||
twine upload --repository-url https://upload.pypi.org/legacy/ dist/cloudbender-*.whl
|
twine upload --repository-url https://upload.pypi.org/legacy/ dist/cloudbender-*.whl
|
||||||
|
|
||||||
build:
|
build:
|
||||||
podman build --rm --squash-all -t $(REPOSITORY):$(TAG) -t $(REPOSITORY):latest .
|
podman build --rm -t $(REPOSITORY):$(TAG) -t $(REPOSITORY):latest .
|
||||||
|
|
||||||
test:
|
test:
|
||||||
@echo "Not implemented (yet)"
|
@echo "Not implemented (yet)"
|
||||||
|
@ -23,7 +23,7 @@ import logging
|
|||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@jinja2.contextfunction
|
@jinja2.pass_context
|
||||||
def option(context, attribute, default_value="", source="options"):
|
def option(context, attribute, default_value="", source="options"):
|
||||||
"""Get attribute from options data structure, default_value otherwise"""
|
"""Get attribute from options data structure, default_value otherwise"""
|
||||||
environment = context.environment
|
environment = context.environment
|
||||||
@ -45,7 +45,7 @@ def option(context, attribute, default_value="", source="options"):
|
|||||||
return default_value
|
return default_value
|
||||||
|
|
||||||
|
|
||||||
@jinja2.contextfunction
|
@jinja2.pass_context
|
||||||
def include_raw_gz(context, files=None, gz=True, remove_comments=False):
|
def include_raw_gz(context, files=None, gz=True, remove_comments=False):
|
||||||
jenv = context.environment
|
jenv = context.environment
|
||||||
output = ""
|
output = ""
|
||||||
@ -88,7 +88,7 @@ def include_raw_gz(context, files=None, gz=True, remove_comments=False):
|
|||||||
return base64.b64encode(buf.getvalue()).decode("utf-8")
|
return base64.b64encode(buf.getvalue()).decode("utf-8")
|
||||||
|
|
||||||
|
|
||||||
@jinja2.contextfunction
|
@jinja2.pass_context
|
||||||
def raise_helper(context, msg):
|
def raise_helper(context, msg):
|
||||||
raise Exception(msg)
|
raise Exception(msg)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user