Skip to content

Commit fa2591d

Browse files
committed
kolla-toolbox: Use py311 on rpm distros
ansible-core 2.16 requires py3.10+ on the host running ansible-playbook - let's use Python 3.11 on RPM distros to have the same version of ansible-core used on all distributions. Change-Id: I2caf2c972cd0283889fadde01bdd6a53e5f66ed9
1 parent 081590b commit fa2591d

File tree

3 files changed

+12
-15
lines changed

3 files changed

+12
-15
lines changed

docker/kolla-toolbox/Dockerfile.j2

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build
66
{% block kolla_toolbox_header %}{% endblock %}
77

88
{% set venv_path='/opt/ansible' %}
9+
{% if base_package_type == 'rpm' %}
10+
{% set distro_python_version = '3.11' %}
11+
{% endif %}
912
{% set os_client_config= venv_path + '/lib/python' + distro_python_version + '/site-packages/os_client_config/defaults.json' %}
1013

1114
{% import "macros.j2" as macros with context %}
@@ -16,7 +19,6 @@ LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build
1619
{{ macros.enable_extra_repos(['crb', 'erlang', 'openvswitch', 'rabbitmq']) }}
1720

1821
{% if base_package_type == 'rpm' %}
19-
2022
{% set kolla_toolbox_packages = [
2123
'crudini',
2224
'erlang-26.2.*',
@@ -31,7 +33,8 @@ LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build
3133
'openssh-clients',
3234
'openssl-devel',
3335
'openvswitch',
34-
'python3-devel',
36+
'python3.11',
37+
'python3.11-devel',
3538
'rabbitmq-server-3.13.*'
3639
] %}
3740

@@ -58,12 +61,13 @@ LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build
5861
RUN mkdir -p /requirements \
5962
&& curl -o /requirements/upper-constraints.txt ${UPPER_CONSTRAINTS_FILE:-https://releases.openstack.org/constraints/upper/{{ openstack_release }}} \
6063
&& {{ macros.upper_constraints_remove("openstacksdk") }} \
61-
&& python3 -m venv --system-site-packages {{ venv_path }}
64+
&& python{{ distro_python_version }} -m venv --system-site-packages {{ venv_path }}
6265
{% endblock %}
6366

6467
ENV PATH {{ venv_path }}/bin:$PATH
6568

6669
{% set kolla_toolbox_pip_packages = [
70+
'ansible-core==2.16.*',
6771
'cmd2',
6872
'influxdb',
6973
'openstacksdk',
@@ -76,14 +80,8 @@ ENV PATH {{ venv_path }}/bin:$PATH
7680
'pyudev',
7781
] %}
7882

79-
{% if base_package_type == 'rpm' %}
80-
{% set kolla_toolbox_pip_packages = kolla_toolbox_pip_packages + ['ansible-core==2.15.*'] %}
81-
{% else %}
82-
{% set kolla_toolbox_pip_packages = kolla_toolbox_pip_packages + ['ansible-core==2.16.*'] %}
83-
{% endif %}
84-
85-
RUN {{ macros.install_pip(['pip', 'wheel', 'setuptools']) }} \
86-
&& {{ macros.install_pip(kolla_toolbox_pip_packages | customizable("pip_packages")) }} \
83+
RUN {{ macros.install_pip(['pip', 'wheel', 'setuptools'], python_version=distro_python_version) }} \
84+
&& {{ macros.install_pip((kolla_toolbox_pip_packages | customizable("pip_packages")), python_version=distro_python_version) }} \
8785
&& mkdir -p /etc/ansible /usr/share/ansible \
8886
&& echo 'localhost ansible_connection=local ansible_python_interpreter={{ venv_path }}/bin/python' > /etc/ansible/hosts \
8987
&& sed -i 's| "identity_api_version": "2.0",| "identity_api_version": "3",|' {{ os_client_config }}

docker/macros.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@
3232
{% endif %}
3333
{%- endmacro %}
3434

35-
{% macro install_pip(packages, constraints = true) %}
35+
{% macro install_pip(packages, constraints=true, python_version='3') %}
3636
{%- if packages is sequence and packages|length > 0 -%}
37-
python3 -m pip --no-cache-dir install --upgrade{{ ' ' }}
37+
python{{ python_version }} -m pip --no-cache-dir install --upgrade{{ ' ' }}
3838
{%- if constraints %}-c /requirements/upper-constraints.txt {% endif -%}
3939
{{ packages | join(' ') }}
4040
{%- else -%}
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
22
upgrade:
33
- |
4-
Kolla toolbox is now using ``ansible-core 2.16`` for DEB
5-
and ``ansible-core 2.15`` for RPM distros.
4+
Kolla toolbox is now using ``ansible-core 2.16``.

0 commit comments

Comments
 (0)