Skip to content

Commit a7ff9f6

Browse files
Marcin Juszkiewiczyoctozepto
authored andcommitted
elasticsearch: install Java first on CentOS too
elasticsearch-oss package fails to install if we install it with Java: INFO:kolla.common.utils.elasticsearch:could not find java; set JAVA_HOME INFO:kolla.common.utils.elasticsearch:error: %prein(elasticsearch-oss-0:6.8.23-1.noarch) scriptlet failed, exit status 1 INFO:kolla.common.utils.elasticsearch:�[91mError in PREIN scriptlet in rpm package elasticsearch-oss Backport down to ussuri needed. This change also includes a backport of I7d4788f5b63fba24e3b2f9b15c16866ff811d83e: Always use the distro-provided libvirt-python This patch switches masakari-monitors image to follow nova-compute and ceilometer-compute images. This will be used and required after [1] merges. Usage of libvirt-python from PyPI has already proven to be problematic on CentOS Stream in our stable branches. [2] With this patch we avoid those issues as well. [1] https://review.opendev.org/c/openstack/masakari-monitors/+/804913 [2] https://review.opendev.org/c/openstack/kolla/+/797102 Depends-On: https://review.opendev.org/c/openstack/masakari-monitors/+/804913 NOTE(hrw): added removal of libvirt-python from upper-constraints as we have never version of libvirt that Victoria used. This change also includes a backport of I5efab66e487e06abd1a56af97d7e7caa1ebc880d: Use jinja2.pass_context instead of contextfilter The contextfilter decorator was deprecated in jinja2 3.0.0, and has been dropped in 3.1.0. This results in the following warning, and failed attempts to use filters: [WARNING]: Skipping plugin (filters.py) as it seems to be invalid: module 'jinja2' has no attribute 'contextfilter' This change switches to use the pass_context decorator. The minimum version of Jinja2 is raised to 3 to ensure pass_context is present. This change has been updated to also support Jinja2 2.x releases, since the Wallaby upper constraints specify 2.11.3. In practice, most users will not use UC to install kolla. CoAuthored-by: Mark Goddard <[email protected]> Finally, amended for Debian Buster to also skip the lower constraint from masakari-monitors. Finally, finally, includes also hotfix for contextfunction. Ie4bccb9ed3f4d8782730c5929abbfa73da215a8c Change-Id: I72d7920acd8d15941c8c57a4186186212b273a38 (cherry picked from commit 976465c)
1 parent 3819c16 commit a7ff9f6

File tree

5 files changed

+27
-8
lines changed

5 files changed

+27
-8
lines changed

docker/elasticsearch/elasticsearch/Dockerfile.j2

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,12 @@ LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build
1212
{{ macros.enable_extra_repos(['elasticsearch']) }}
1313

1414
{% if base_package_type == 'rpm' %}
15+
16+
# NOTE(hrw): post-install script of elasticsearch fails when trying to
17+
# install elasticsearch and java together.
18+
{{ macros.install_packages(['java-11-openjdk-headless']) }}
19+
1520
{% set elasticsearch_packages = [
16-
'java-11-openjdk-headless',
1721
'elasticsearch-oss',
1822
] %}
1923

docker/masakari/masakari-monitors/Dockerfile.j2

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \
1919
{% if base_package_type == 'rpm' %}
2020

2121
{% set masakari_monitors_packages = [
22-
'libvirt-devel',
22+
'python3-libvirt',
2323
'pacemaker-cli',
2424
'tcpdump',
2525
] %}
2626

2727
{% elif base_package_type == 'deb' %}
2828

2929
{% set masakari_monitors_packages = [
30-
'libvirt-dev',
30+
'python3-libvirt',
3131
'pacemaker-cli-utils',
3232
'tcpdump',
3333
] %}
@@ -42,8 +42,10 @@ ADD masakari-monitors-archive /masakari-monitors-source
4242
'/masakari-monitors'
4343
] %}
4444

45+
# NOTE(hrw): distros may provide other version of libvirt
4546
RUN ln -s masakari-monitors-source/* masakari-monitors \
46-
{% if distro_package_manager == 'dnf' %}&& sed -i -e 's/libvirt-python===.*/libvirt-python===6.10.0/' /requirements/upper-constraints.txt {% endif %}\
47+
&& sed -i -e "/^libvirt-python/d" /requirements/upper-constraints.txt \
48+
&& sed -i -e "/^libvirt-python/d" /masakari-monitors/requirements.txt \
4749
&& {{ macros.install_pip(masakari_monitors_pip_packages | customizable("pip_packages")) }} \
4850
&& mkdir -p /etc/masakari-monitors \
4951
&& chown -R masakari: /etc/masakari-monitors

kolla/template/filters.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,16 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
from jinja2 import contextfilter
15+
# NOTE: jinja2 3.1.0 dropped contextfilter in favour of pass_context.
16+
try:
17+
from jinja2 import pass_context
18+
except ImportError:
19+
from jinja2 import contextfilter as pass_context
20+
1621
from jinja2 import Undefined
1722

1823

19-
@contextfilter
24+
@pass_context
2025
def customizable(context, val_list, call_type):
2126
# NOTE(mgoddard): Don't try to customise undefined values. There are cases
2227
# where this might happen, for example using a generic template overrides

kolla/template/methods.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@
1515
import os
1616
import yaml
1717

18-
from jinja2 import contextfunction
18+
# NOTE: jinja2 3.1.0 dropped contextfunction in favour of pass_context.
19+
try:
20+
from jinja2 import pass_context
21+
except ImportError:
22+
from jinja2 import contextfunction as pass_context
1923

2024

2125
def debian_package_install(packages, clean_package_cache=True):
@@ -71,7 +75,7 @@ def debian_package_install(packages, clean_package_cache=True):
7175
return ' && '.join(cmds)
7276

7377

74-
@contextfunction
78+
@pass_context
7579
def handle_repos(context, reponames, mode):
7680
"""NOTE(hrw): we need to handle CentOS, Debian and Ubuntu with one macro.
7781
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
fixes:
3+
- |
4+
Fixes an issue seen when using Jinja2 3.1.0.

0 commit comments

Comments
 (0)