Fix ubuntu binary deploys

1. Install python3-pymysql in placement-base image.
2. Remove default placement WSGI config.
3. Use python3 for manage.py in horizon

Change-Id: Ibb620af2241e39fe99bc48757f90296c0d77d438
Partial-Bug: #1823989
This commit is contained in:
Mark Goddard 2019-04-09 17:43:54 +01:00
parent 473695264f
commit 6c00651859
3 changed files with 17 additions and 12 deletions

View File

@ -4,12 +4,23 @@ set -o errexit
FORCE_GENERATE="${FORCE_GENERATE}"
# TODO(mgoddard): Remove this elif when Ubuntu has distro_python_version == 3.
if [[ ${KOLLA_INSTALL_TYPE} == "binary" ]] && [[ "${KOLLA_BASE_DISTRO}" =~ ubuntu ]]; then
KOLLA_DISTRO_PYTHON_VERSION=3
fi
if [[ ${KOLLA_INSTALL_TYPE} == "binary" ]]; then
SITE_PACKAGES="/usr/lib/python${KOLLA_DISTRO_PYTHON_VERSION}/site-packages"
elif [[ ${KOLLA_INSTALL_TYPE} == "source" ]]; then
SITE_PACKAGES="/var/lib/kolla/venv/lib/python${KOLLA_DISTRO_PYTHON_VERSION}/site-packages"
fi
if [[ -f "/var/lib/kolla/venv/bin/python" ]]; then
MANAGE_PY="/var/lib/kolla/venv/bin/python /var/lib/kolla/venv/bin/manage.py"
else
MANAGE_PY="/usr/bin/python${KOLLA_DISTRO_PYTHON_VERSION} /usr/bin/manage.py"
fi
if [[ ${KOLLA_INSTALL_TYPE} == "source" ]] && [[ ! -f ${SITE_PACKAGES}/openstack_dashboard/local/local_settings.py ]]; then
ln -s /etc/openstack-dashboard/local_settings \
${SITE_PACKAGES}/openstack_dashboard/local/local_settings.py
@ -29,10 +40,6 @@ fi
# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases
# of the KOLLA_BOOTSTRAP variable being set, including empty.
if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then
MANAGE_PY="/usr/bin/python /usr/bin/manage.py"
if [[ -f "/var/lib/kolla/venv/bin/python" ]]; then
MANAGE_PY="/var/lib/kolla/venv/bin/python /var/lib/kolla/venv/bin/manage.py"
fi
$MANAGE_PY migrate --noinput
exit 0
fi
@ -340,13 +347,8 @@ else
fi
if settings_changed; then
if [[ "${KOLLA_INSTALL_TYPE}" == "binary" ]]; then
/usr/bin/manage.py collectstatic --noinput --clear
/usr/bin/manage.py compress --force
elif [[ "${KOLLA_INSTALL_TYPE}" == "source" ]]; then
/var/lib/kolla/venv/bin/python /var/lib/kolla/venv/bin/manage.py collectstatic --noinput --clear
/var/lib/kolla/venv/bin/python /var/lib/kolla/venv/bin/manage.py compress --force
fi
${MANAGE_PY} collectstatic --noinput --clear
${MANAGE_PY} compress --force
fi
# NOTE(sbezverk) since Horizon is now storing logs in its own location, /var/log/horizon

View File

@ -32,7 +32,8 @@ RUN sed -i -r 's,^(Listen 80),#\1,' /etc/httpd/conf/httpd.conf \
] %}
{{ macros.install_packages(placement_api_packages | customizable("packages")) }}
RUN truncate -s 0 /etc/apache2/ports.conf
RUN truncate -s 0 /etc/apache2/ports.conf \
&& rm -f /etc/apache2/sites-enabled/placement-api.conf
{% endif %}
{% elif install_type == 'source' %}

View File

@ -17,9 +17,11 @@ LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build
{% elif base_package_type == 'deb' %}
# TODO(mgoddard): Remove python3-pymysql when in openstack-base.
{% set placement_base_packages = [
'mariadb-client',
'placement-common',
'python3-pymysql',
] %}
{% endif %}