summaryrefslogtreecommitdiff
path: root/docker
diff options
context:
space:
mode:
authorMarcin Juszkiewicz <marcin.juszkiewicz@linaro.org>2019-03-08 13:19:03 +0100
committerMarcin Juszkiewicz <marcin.juszkiewicz@linaro.org>2019-03-12 17:13:46 +0000
commit8df6eb01184672ffdc752437ea4d98d13f16026e (patch)
treee4121f587d342afa739a6ffde89074d978eea648 /docker
parent8ae32bb17258a2211e03592bfaae6c648cda6089 (diff)
downloadkolla-8df6eb01184672ffdc752437ea4d98d13f16026e.tar.gz
kolla-8df6eb01184672ffdc752437ea4d98d13f16026e.zip
replace 'distro_python3' variable with 'distro_python_version'
RHEL7 derived distros use Python 2.7 RHEL8 uses Python 3.6 Ubuntu 18.04 uses Python 3.6, but we haven't enabled it yet. Debian:buster uses Python 3.7, but we haven't enabled it yet. We have several places in code where "/lib/pythonX.Y/site-packages" is used so we need to know value of X.Y rather than py2/py3 switch. How to check for Python 2: {% if distro_python_version == '2.7' %} Breaks: Iad6b70b433a0dd1b0f8ae6790fd280594517661a Change-Id: Ie24f109af19ae0438c21e0d43cb3cc947812b4ce
Diffstat (limited to 'docker')
-rw-r--r--docker/base/Dockerfile.j23
-rw-r--r--docker/horizon/Dockerfile.j26
-rw-r--r--docker/horizon/extend_start.sh4
-rw-r--r--docker/kolla-toolbox/Dockerfile.j22
-rw-r--r--docker/macros.j27
-rw-r--r--docker/openstack-base/Dockerfile.j210
6 files changed, 22 insertions, 10 deletions
diff --git a/docker/base/Dockerfile.j2 b/docker/base/Dockerfile.j2
index bd75f6a90..98e8ff132 100644
--- a/docker/base/Dockerfile.j2
+++ b/docker/base/Dockerfile.j2
@@ -17,7 +17,8 @@ LABEL kolla_version="{{ kolla_version }}"
ENV KOLLA_BASE_DISTRO={{ base_distro }} \
KOLLA_INSTALL_TYPE={{ install_type }} \
- KOLLA_INSTALL_METATYPE={{ install_metatype }}
+ KOLLA_INSTALL_METATYPE={{ install_metatype }} \
+ KOLLA_DISTRO_PYTHON_VERSION={{ distro_python_version }}
#### Customize PS1 to be used with bash shell
COPY kolla_bashrc /tmp/
diff --git a/docker/horizon/Dockerfile.j2 b/docker/horizon/Dockerfile.j2
index 0fbeb39db..f2f341202 100644
--- a/docker/horizon/Dockerfile.j2
+++ b/docker/horizon/Dockerfile.j2
@@ -74,7 +74,7 @@ RUN echo > /etc/apache2/ports.conf \
&& cp /usr/share/openstack-dashboard/openstack_dashboard/conf/*.json /etc/openstack-dashboard \
&& cp /usr/share/openstack-dashboard/manage.py /usr/bin/manage.py \
&& rm /etc/apache2/conf-enabled/openstack-dashboard.conf \
- && for locale in /usr/lib/python2.7/site-packages/*/locale; do \
+ && for locale in /usr/lib/python{{distro_python_version}}/site-packages/*/locale; do \
(cd ${locale%/*} && /usr/bin/python /usr/bin/manage.py compilemessages) \
done
{% endblock %}
@@ -136,10 +136,10 @@ RUN ln -s horizon-source/* horizon \
&& if [ "$(ls /plugins)" ]; then \
{{ macros.install_pip(horizon_plugins_pip_packages) }}; \
fi \
- && for locale in /var/lib/kolla/venv/lib/python2.7/site-packages/*/locale; do \
+ && for locale in /var/lib/kolla/venv/lib/python{{distro_python_version}}/site-packages/*/locale; do \
(cd ${locale%/*} && /var/lib/kolla/venv/bin/python /var/lib/kolla/venv/bin/manage.py compilemessages) \
done \
- && chown -R horizon: /etc/openstack-dashboard /var/lib/kolla/venv/lib/python2.7/site-packages/static
+ && chown -R horizon: /etc/openstack-dashboard /var/lib/kolla/venv/lib/python{{distro_python_version}}/site-packages/static
{% endif %}
diff --git a/docker/horizon/extend_start.sh b/docker/horizon/extend_start.sh
index 8a3227166..1dc6aeb60 100644
--- a/docker/horizon/extend_start.sh
+++ b/docker/horizon/extend_start.sh
@@ -5,9 +5,9 @@ set -o errexit
FORCE_GENERATE="${FORCE_GENERATE}"
if [[ ${KOLLA_INSTALL_TYPE} == "binary" ]]; then
- SITE_PACKAGES="/usr/lib/python2.7/site-packages"
+ SITE_PACKAGES="/usr/lib/python${KOLLA_DISTRO_PYTHON_VERSION}/site-packages"
elif [[ ${KOLLA_INSTALL_TYPE} == "source" ]]; then
- SITE_PACKAGES="/var/lib/kolla/venv/lib/python2.7/site-packages"
+ SITE_PACKAGES="/var/lib/kolla/venv/lib/python${KOLLA_DISTRO_PYTHON_VERSION}/site-packages"
fi
if [[ ${KOLLA_INSTALL_TYPE} == "source" ]] && [[ ! -f ${SITE_PACKAGES}/openstack_dashboard/local/local_settings.py ]]; then
diff --git a/docker/kolla-toolbox/Dockerfile.j2 b/docker/kolla-toolbox/Dockerfile.j2
index ca616074b..4af30dede 100644
--- a/docker/kolla-toolbox/Dockerfile.j2
+++ b/docker/kolla-toolbox/Dockerfile.j2
@@ -4,7 +4,7 @@ LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build
{% block kolla_toolbox_header %}{% endblock %}
{% set virtualenv_path='/opt/ansible' %}
-{% set os_client_config= virtualenv_path + '/lib/python2.7/site-packages/os_client_config/defaults.json' %}
+{% set os_client_config= virtualenv_path + '/lib/python' + distro_python_version + '/site-packages/os_client_config/defaults.json' %}
{% import "macros.j2" as macros with context %}
diff --git a/docker/macros.j2 b/docker/macros.j2
index aee933e7b..419fa0f4f 100644
--- a/docker/macros.j2
+++ b/docker/macros.j2
@@ -22,8 +22,13 @@
{%- endmacro %}
{% macro get_pip() %}
+{% if distro_python_version == '2.7' %}
+ {% set python='python' %}
+{% else %}
+ {% set python='python3' %}
+{% endif %}
RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py \
- && python get-pip.py \
+ && {{python}} get-pip.py \
&& rm get-pip.py
{% endmacro %}
diff --git a/docker/openstack-base/Dockerfile.j2 b/docker/openstack-base/Dockerfile.j2
index c3dab166a..4f6627197 100644
--- a/docker/openstack-base/Dockerfile.j2
+++ b/docker/openstack-base/Dockerfile.j2
@@ -211,11 +211,9 @@ ENV DEBIAN_FRONTEND noninteractive
'debtcollector',
'decorator',
'elasticsearch',
- 'enum34',
'eventlet',
'fasteners',
'funcsigs',
- 'functools32',
'futures',
'futurist',
'gnocchiclient',
@@ -297,6 +295,14 @@ ENV DEBIAN_FRONTEND noninteractive
]
%}
+{% if distro_python_version == '2.7' %}
+ {% set openstack_base_pip_packages = openstack_base_pip_packages + [
+ 'enum34',
+ 'functools32'
+ ]
+ %}
+{% endif %}
+
ADD openstack-base-archive /openstack-base-source
RUN ln -s openstack-base-source/* /requirements \
&& mkdir -p /var/lib/kolla \