From df987c9d3fca40e0a7529e48a3626dfdd58e2168 Mon Sep 17 00:00:00 2001 From: Marcin Juszkiewicz Date: Thu, 5 Dec 2019 12:40:05 +0100 Subject: Introduce macro to remove Py3 only plugins on CentOS 7 As CentOS 7 is Python 2 we need a way to remove plugins used in OpenStack components once they switch to be Python 3 only. 'remove_py3_only_plugins_for_py2' macro does exactly that. This change also disables networking-bgpvpn for python 2. Change-Id: Ib90aabc485f1c831d3d41cc0f70052f8fffc3fe6 Related: blueprint drop-py2-support --- docker/horizon/Dockerfile.j2 | 5 +---- docker/macros.j2 | 10 ++++++++++ docker/neutron/neutron-server-opendaylight/Dockerfile.j2 | 3 +-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/docker/horizon/Dockerfile.j2 b/docker/horizon/Dockerfile.j2 index d6cd20343..f2e779c8f 100644 --- a/docker/horizon/Dockerfile.j2 +++ b/docker/horizon/Dockerfile.j2 @@ -163,10 +163,7 @@ RUN ln -s horizon-source/* horizon \ && cp -r /horizon/openstack_dashboard/conf/* /etc/openstack-dashboard/ \ && cp /horizon/openstack_dashboard/local/local_settings.py.example /etc/openstack-dashboard/local_settings \ && cp /horizon/manage.py /var/lib/kolla/venv/bin/manage.py \ - {# NOTE(hrw) some plugins already moved to Python 3 and CentOS 7 uses Python 2 #} - {% if base_package_type == 'rpm' and base_distro_tag.startswith('7') %} - && rm -rf /plugins/searchlight-ui* /plugins/neutron-vpnaas-dashboard* \ - {% endif %} + {{ macros.remove_py3_only_plugins_for_py2(['searchlight-ui', 'neutron-vpnaas-dashboard']) }} && if [ "$(ls /plugins)" ]; then \ {{ macros.install_pip(horizon_plugins_pip_packages) }}; \ fi \ diff --git a/docker/macros.j2 b/docker/macros.j2 index 8c698d278..f52ff2235 100644 --- a/docker/macros.j2 +++ b/docker/macros.j2 @@ -97,3 +97,13 @@ RUN usermod --append --home {{ homedir }} --groups kolla {{ name }} \ {{ enable_repos(repos) }} {% endmacro %} + +# NOTE(hrw): ending \ has to be at the end as we generate one line and there +# can be multiple plugins to remove +{% macro remove_py3_only_plugins_for_py2(plugins_to_remove) -%} + {% if distro_python_version == '2.7' -%} + {% for plugin in plugins_to_remove %}&& rm -rf /plugins/{{ plugin }}* {% endfor %} \ + {%- else -%} + \ + {%- endif %} +{%- endmacro %} diff --git a/docker/neutron/neutron-server-opendaylight/Dockerfile.j2 b/docker/neutron/neutron-server-opendaylight/Dockerfile.j2 index 287274a5e..da032f8d4 100644 --- a/docker/neutron/neutron-server-opendaylight/Dockerfile.j2 +++ b/docker/neutron/neutron-server-opendaylight/Dockerfile.j2 @@ -18,8 +18,6 @@ USER root ] %} {% else %} {% set neutron_server_opendaylight_packages = [ - 'python-networking-bgpvpn', - 'python-networking-bgpvpn-heat', 'python-networking-l2gw', 'python-networking-odl' ] %} @@ -58,6 +56,7 @@ ADD plugins-archive / RUN if [ "$(ls /plugins)" ]; then \ sed -i 's|^ceilometer===.*$||g' requirements/upper-constraints.txt \ + {{ macros.remove_py3_only_plugins_for_py2(['networking-bgpvpn']) }} && {{ macros.install_pip(neutron_server_opendaylight_plugins_pip_packages) }}; \ fi -- cgit v1.2.3