fix: migrate to new Jinja2 V3 context decorator

This commit is contained in:
Stefan Reimer 2022-04-19 12:47:36 +02:00
parent 4abed82b8a
commit 6f31560262
2 changed files with 4 additions and 4 deletions

View File

@ -36,7 +36,7 @@ upload: $(PACKAGE_FILE)
twine upload --repository-url https://upload.pypi.org/legacy/ dist/cloudbender-*.whl
build:
podman build --rm --squash-all -t $(REPOSITORY):$(TAG) -t $(REPOSITORY):latest .
podman build --rm -t $(REPOSITORY):$(TAG) -t $(REPOSITORY):latest .
test:
@echo "Not implemented (yet)"

View File

@ -23,7 +23,7 @@ import logging
logger = logging.getLogger(__name__)
@jinja2.contextfunction
@jinja2.pass_context
def option(context, attribute, default_value="", source="options"):
"""Get attribute from options data structure, default_value otherwise"""
environment = context.environment
@ -45,7 +45,7 @@ def option(context, attribute, default_value="", source="options"):
return default_value
@jinja2.contextfunction
@jinja2.pass_context
def include_raw_gz(context, files=None, gz=True, remove_comments=False):
jenv = context.environment
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")
@jinja2.contextfunction
@jinja2.pass_context
def raise_helper(context, msg):
raise Exception(msg)