aboutsummaryrefslogtreecommitdiff
path: root/kolla/template/filters.py
AgeCommit message (Collapse)AuthorFilesLines
2022-10-06drop shebang from Python filesMarcin Juszkiewicz1-2/+0
Only kolla/cmd/build.py is an executable script used by user (either as 'kolla-build' or 'tools/build.py' or directly). Change-Id: Ia1ba2699f425749f9d4f2cdba27caeb97bc3d668
2022-03-28Revert "Revert "Update code to Jinja 3.0 style""Marcin Juszkiewicz1-2/+2
This reverts commit 25e9602845fca7ca5b7a5c55fe5b71be0b137f04. Reason for revert: we updated to newer Jinja. Change-Id: If666bb4aedd7bb4e3041f0672c3b70e1bb5d36b6
2021-08-25Revert "Update code to Jinja 3.0 style"Alfredo Moralejo1-2/+2
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
2021-07-29Update code to Jinja 3.0 styleMarcin Juszkiewicz1-2/+2
Xena cycle uses Jinja 3.0 so let update Kolla's code for it. From Jinja2 documentation: jinja2.contextfunction(f: F) → F Pass the context as the first argument to the decorated function. Deprecated since version 3.0: Will be removed in Jinja 3.1. Use pass_context() instead. jinja2.contextfilter(f) Pass the context as the first argument to the decorated function. Deprecated since version 3.0: Will be removed in Jinja 3.1. Use pass_context() instead. Also bumped version in requirements.txt to same as in openstack/requirements Change-Id: I51fbb7b9ff7c29cb355437efa4576be9bc035699
2018-12-24Ignore undefined values in customizable filterMark Goddard1-0/+7
When using the customizable filter to modify variables, if a template overrides file is shared between multiple sets of images, it is sometimes possible that a customised variable does not exist for a set of images. A specific example: My template overrides file has this: {% set ironic_inspector_packages_append = ["python-pip"] %} Normally I build binary/centos images. kolla-build -t binary Sometimes however I build a bifrost centos/source image, because bifrost does not support binary images. kolla-build -t source bifrost The ironic inspector image does not define ironic_inspector_packages for the source build, since it does not need any. {% elif install_type == 'source' %} {% if base_distro in ['debian', 'ubuntu'] %} {% set ironic_inspector_packages = ['iptables'] %} {% endif %} {{ macros.install_packages(ironic_inspector_packages | customizable("packages")) }} The install_packages macro copes with the undefined variable, however the customizable filter does not handle the base variable being undefined if a customised example exists. This change allows the customizable filter to ignore undefined variables, even if they have been customised. Change-Id: Ibe2fc91f5b6ceee8f937dd73c235128b2db525b1 Closes-Bug: #1809491
2016-06-24Customizations continuedMichal (inc0) Jastrzebski1-0/+29
To correctly customize lists, we need to specify *_append, *_remove or *_override variable in customization file. Change-Id: I18d67ab89089e2696399ff1b99c1047a2f554442 Partially-implements: blueprint third-party-plugin-support