From 25e9602845fca7ca5b7a5c55fe5b71be0b137f04 Mon Sep 17 00:00:00 2001 From: Alfredo Moralejo Date: Wed, 25 Aug 2021 10:50:06 +0000 Subject: [PATCH] Revert "Update code to Jinja 3.0 style" This reverts commit 383364e671fb82e3c0ddca37a4690a1a33be3b54. Reason for revert: Xena stay in jinja 3.0.1 which still provides contextfilter. In RDO, jinja is consumed from CentOS repo which still provides version 2.11, so this change is causing problems. I'm proposing to revert this change and retake it Y release when jinja is updated to 3.1 which will not provide contextfilter. Change-Id: I19c2a15fb0917d2a81daf706a4e02fd377e53b3d --- kolla/template/filters.py | 4 ++-- kolla/template/methods.py | 4 ++-- requirements.txt | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/kolla/template/filters.py b/kolla/template/filters.py index 3f2ede9566..49708ee3fc 100644 --- a/kolla/template/filters.py +++ b/kolla/template/filters.py @@ -12,11 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -from jinja2 import pass_context +from jinja2 import contextfilter from jinja2 import Undefined -@pass_context +@contextfilter def customizable(context, val_list, call_type): # NOTE(mgoddard): Don't try to customise undefined values. There are cases # where this might happen, for example using a generic template overrides diff --git a/kolla/template/methods.py b/kolla/template/methods.py index 69434ef504..19fcf4e22f 100644 --- a/kolla/template/methods.py +++ b/kolla/template/methods.py @@ -15,7 +15,7 @@ import os import yaml -from jinja2 import pass_context +from jinja2 import contextfunction def debian_package_install(packages, clean_package_cache=True): @@ -71,7 +71,7 @@ def debian_package_install(packages, clean_package_cache=True): return ' && '.join(cmds) -@pass_context +@contextfunction def handle_repos(context, reponames, mode): """NOTE(hrw): we need to handle CentOS, Debian and Ubuntu with one macro. diff --git a/requirements.txt b/requirements.txt index 7d1c0d9dbb..9d5bd1cf3c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ pbr!=2.1.0,>=2.0.0 # Apache-2.0 docker>=2.4.2 # Apache-2.0 -Jinja2>=3.0.1 # BSD License (3 clause) +Jinja2>=2.8 # BSD License (3 clause) GitPython>=1.0.1 # BSD License (3 clause) oslo.config>=5.1.0 # Apache-2.0