Fix neutron lbaas dashboard

Load neutron lbaas dynamic when neutron lbaas is enabled.

Change-Id: I47913824fea87b721f254633c16d1dc6903b4f5d
Closes-Bug: #1639325
This commit is contained in:
Jeffrey Zhang 2016-11-05 02:28:02 +08:00
parent 6e7d73be16
commit c89cbff6a2
3 changed files with 32 additions and 5 deletions

View File

@ -5,6 +5,8 @@
common_options: "{{ docker_common_options }}"
image: "{{ horizon_image_full }}"
name: "horizon"
environment:
ENABLE_NEUTRON_LBAAS: "{{ 'yes' if enable_neutron_lbaas | bool else 'no' }}"
volumes:
- "{{ node_config_directory }}/horizon/:{{ container_config_directory }}/:ro"
- "/etc/localtime:/etc/localtime:ro"

View File

@ -12,7 +12,8 @@ MAINTAINER {{ maintainer }}
'openstack-dashboard',
'httpd',
'mod_wsgi',
'gettext'
'gettext',
'openstack-neutron-lbaas-ui'
] %}
{{ macros.install_packages(horizon_packages | customizable("packages")) }}
@ -28,7 +29,8 @@ RUN useradd --user-group horizon \
&& cp /usr/share/openstack-dashboard/manage.py /usr/bin/manage.py \
&& /usr/bin/python /usr/bin/manage.py collectstatic --noinput --clear \
&& (cd /usr/lib/python2.7/site-packages/horizon && /usr/bin/python /usr/bin/manage.py compilemessages) \
&& (cd /usr/lib/python2.7/site-packages/openstack_dashboard && /usr/bin/python /usr/bin/manage.py compilemessages)
&& (cd /usr/lib/python2.7/site-packages/openstack_dashboard && /usr/bin/python /usr/bin/manage.py compilemessages) \
&& rm -f /usr/share/openstack-dashboard/openstack_dashboard/local/enabled/_148*_project*loadbalancersv2_panel.py*
{% endblock %}
{% elif base_distro in ['ubuntu'] %}
@ -107,8 +109,6 @@ RUN ln -s horizon-source/* horizon \
&& cp /horizon/manage.py /var/lib/kolla/venv/bin/manage.py \
&& if [ "$(ls /plugins)" ]; then \
pip --no-cache-dir install --upgrade -c requirements/upper-constraints.txt /plugins/*; \
ln -s `find /plugins -name 'neutron-lbaas-dashboard-*' -type d`/neutron_lbaas_dashboard/enabled/_1481_project_ng_loadbalancersv2_panel.py \
/var/lib/kolla/venv/lib/python2.7/site-packages/openstack_dashboard/enabled/_1481_project_ng_loadbalancersv2_panel.py; \
fi \
&& /var/lib/kolla/venv/bin/python /var/lib/kolla/venv/bin/manage.py collectstatic --noinput --clear \
&& (cd /var/lib/kolla/venv/lib/python2.7/site-packages/horizon && /var/lib/kolla/venv/bin/python /var/lib/kolla/venv/bin/manage.py compilemessages) \

View File

@ -1,5 +1,7 @@
#!/bin/bash
set -o errexit
# 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
@ -11,6 +13,29 @@ if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then
exit 0
fi
FORCE_GENERATE="no"
if [[ ${KOLLA_INSTALL_TYPE} == "binary" ]]; then
SITE_PACKAGES="/usr/lib/python2.7/site-packages"
elif [[ ${KOLLA_INSTALL_TYPE} == "source" ]]; then
SITE_PACKAGES="/var/lib/kolla/venv/lib/python2.7/site-packages"
fi
function config_neutron_lbaas {
SRC="${SITE_PACKAGES}/neutron_lbaas_dashboard/enabled/_1481_project_ng_loadbalancersv2_panel.py"
DEST="${SITE_PACKAGES}/openstack_dashboard/local/enabled/_1481_project_ng_loadbalancersv2_panel.py"
if [[ "${ENABLE_NEUTRON_LBAAS}" == "yes" ]] && [[ ! -f ${DEST} ]]; then
cp -a $SRC $DEST
FORCE_GENERATE="yes"
elif [[ "${ENABLE_NEUTRON_LBAAS}" != "yes" ]] && [[ -f ${DEST} ]]; then
# remove pyc pyo files too
rm -f ${DEST} ${DEST}c ${DEST}o
FORCE_GENERATE="yes"
fi
}
config_neutron_lbaas
# NOTE(pbourke): httpd will not clean up after itself in some cases which
# results in the container not being able to restart. (bug #1489676, 1557036)
if [[ "${KOLLA_BASE_DISTRO}" =~ debian|ubuntu ]]; then
@ -25,7 +50,7 @@ fi
# behavior, so re-generate the compressed javascript and css if it
# is changed
MD5SUM_TXT_PATH="/tmp/.local_settings.md5sum.txt"
if [[ ! -f ${MD5SUM_TXT_PATH} || $(md5sum -c --status ${MD5SUM_TXT_PATH};echo $?) != 0 ]]; then
if [[ ! -f ${MD5SUM_TXT_PATH} || $(md5sum -c --status ${MD5SUM_TXT_PATH};echo $?) != 0 || ${FORCE_GENERATE} == "yes" ]]; then
md5sum /etc/openstack-dashboard/local_settings > ${MD5SUM_TXT_PATH}
if [[ "${KOLLA_INSTALL_TYPE}" == "binary" ]]; then
/usr/bin/manage.py compress --force