From 39aba34b2a884887cab117ff233469051cc2ec22 Mon Sep 17 00:00:00 2001
From: Sam Yaple <sam@yaple.net>
Date: Sun, 27 Sep 2015 08:10:59 +0000
Subject: [PATCH] Remove all fail sections for Ubuntu

Ubuntu binary is not supported and may never be. Installing from
cloud-archive packaging is only for the current stable distros, Ubuntu
does not have a Delorean type repo. We place a fail message in the
base image to catch this and remove the messages throughout the
project.

An additional fail message is placed to catch all other things.

Change-Id: Id2953f503ebd42226f6a08e75979ae56511c40f7
Implements: blueprint install-from-ubuntu
---
 docker/base/Dockerfile.j2                     | 23 +++++++++++++++++++
 .../ceilometer/ceilometer-base/Dockerfile.j2  |  9 +-------
 docker/cinder/cinder-base/Dockerfile.j2       |  5 ----
 docker/designate/designate-base/Dockerfile.j2 |  6 -----
 docker/glance/glance-base/Dockerfile.j2       |  6 -----
 docker/heat/heat-api-cfn/Dockerfile.j2        |  5 ----
 docker/heat/heat-api/Dockerfile.j2            |  5 ----
 docker/heat/heat-base/Dockerfile.j2           |  8 +------
 docker/heat/heat-engine/Dockerfile.j2         | 15 ++++--------
 docker/horizon/Dockerfile.j2                  |  8 -------
 docker/ironic/ironic-base/Dockerfile.j2       |  9 ++------
 docker/keystone/Dockerfile.j2                 | 14 -----------
 docker/magnum/magnum-base/Dockerfile.j2       |  4 ++--
 docker/murano/murano-base/Dockerfile.j2       |  7 +-----
 docker/neutron/neutron-base/Dockerfile.j2     | 13 ++++-------
 docker/nova/nova-base/Dockerfile.j2           |  8 +------
 docker/swift/swift-base/Dockerfile.j2         |  9 ++------
 docker/zaqar/Dockerfile.j2                    |  9 ++------
 18 files changed, 44 insertions(+), 119 deletions(-)

diff --git a/docker/base/Dockerfile.j2 b/docker/base/Dockerfile.j2
index a3dae428a7..3623872475 100644
--- a/docker/base/Dockerfile.j2
+++ b/docker/base/Dockerfile.j2
@@ -1,6 +1,29 @@
 FROM {{ base_distro }}:{{ base_distro_tag }}
 MAINTAINER Kolla Project (https://launchpad.net/kolla)
 
+# Early failure for bases and types
+{% if base_distro in ['fedora', 'centos', 'oraclelinux', 'rhel'] %}
+    {% if install_type not in ['source', 'binary', 'rdo', 'rhel'] %}
+
+RUN echo 'ERROR: {{ install_type }} is unavailable for {{ base_distro }}' \
+    && /bin/false
+
+    {% endif %}
+{% elif base_distro in ['ubuntu', 'debian'] %}
+    {% if install_type not in ['source'] %}
+
+RUN echo 'ERROR: {{ install_type }} is unavailable for {{ base_distro }}' \
+    && /bin/false
+
+    {% endif %}
+{% else %}
+
+RUN echo 'ERROR: The specified distro has no Kolla images to build: "{{ base_distro }}"' \
+    && /bin/false
+
+{% endif %}
+
+
 {{ include_header }}
 
 ENV KOLLA_BASE_DISTRO {{ base_distro }}
diff --git a/docker/ceilometer/ceilometer-base/Dockerfile.j2 b/docker/ceilometer/ceilometer-base/Dockerfile.j2
index 8a469d43fc..43c399a8d9 100644
--- a/docker/ceilometer/ceilometer-base/Dockerfile.j2
+++ b/docker/ceilometer/ceilometer-base/Dockerfile.j2
@@ -1,14 +1,7 @@
 FROM {{ namespace }}/{{ base_distro }}-{{ install_type }}-openstack-base:{{ tag }}
 MAINTAINER Kolla Project (https://launchpad.net/kolla)
 
-{% if install_type == 'binary' %}
-     {% if base_distro in ['ubuntu', 'debian'] %}
-
-RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \
-  && /bin/false
-
-    {% endif %}
-{% elif install_type == 'source' %}
+{% if install_type == 'source' %}
 
 ADD ceilometer-base-archive /ceilometer-base-source
 RUN ln -s ceilometer-base-source/* ceilometer \
diff --git a/docker/cinder/cinder-base/Dockerfile.j2 b/docker/cinder/cinder-base/Dockerfile.j2
index d33d1c01f2..1e2553f798 100644
--- a/docker/cinder/cinder-base/Dockerfile.j2
+++ b/docker/cinder/cinder-base/Dockerfile.j2
@@ -14,11 +14,6 @@ RUN yum -y install openstack-cinder \
 # NOTE(sdake): The sed operations make LVM tools work inside a container - see
 # https://groups.google.com/forum/#!topic/docker-user/n4Xtvsb4RAw
 
-     {% elif base_distro in ['ubuntu', 'debian'] %}
-
-RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \
-  && /bin/false
-
     {% endif %}
 {% elif install_type == 'source' %}
     {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %}
diff --git a/docker/designate/designate-base/Dockerfile.j2 b/docker/designate/designate-base/Dockerfile.j2
index 84e033c50a..b12fa013be 100644
--- a/docker/designate/designate-base/Dockerfile.j2
+++ b/docker/designate/designate-base/Dockerfile.j2
@@ -4,7 +4,6 @@ MAINTAINER Kolla Project (https://launchpad.net.kolla)
 {% if install_type == 'binary' %}
     {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %}
 
-
 # Install designate-api because of /etc/designate/policy.json, which
 # is needed in all services. This is probably a packaging bug. We do
 # need the complete policy file because of some of the containers'
@@ -18,11 +17,6 @@ RUN yum install -y \
     && rpm -e openstack-designate-api \
     && mv /tmp/policy.json /etc/designate/
 
-    {% elif base_distro in ['ubuntu', 'debian'] %}
-
-RUN echo '{{ install_type}} not yet available for {{ base_distro }}' \
-    && /bin/false
-
     {% endif %}
 {% elif install_type == 'source' %}
 
diff --git a/docker/glance/glance-base/Dockerfile.j2 b/docker/glance/glance-base/Dockerfile.j2
index ef5fcfb392..cc628b8835 100644
--- a/docker/glance/glance-base/Dockerfile.j2
+++ b/docker/glance/glance-base/Dockerfile.j2
@@ -4,7 +4,6 @@ MAINTAINER Kolla Project (https://launchpad.net/kolla)
 {% if install_type == 'binary' %}
     {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %}
 
-
 RUN yum -y install \
         openstack-glance \
         python-oslo-i18n \
@@ -12,11 +11,6 @@ RUN yum -y install \
         python-cryptography \
     && yum clean all
 
-    {% elif base_distro in ['ubuntu', 'debian'] %}
-
-RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \
-    && /bin/false
-
     {% endif %}
 {% elif install_type == 'source' %}
     {% if base_distro in ['ubuntu', 'debian'] %}
diff --git a/docker/heat/heat-api-cfn/Dockerfile.j2 b/docker/heat/heat-api-cfn/Dockerfile.j2
index 54457708f8..7e8701eda7 100644
--- a/docker/heat/heat-api-cfn/Dockerfile.j2
+++ b/docker/heat/heat-api-cfn/Dockerfile.j2
@@ -7,11 +7,6 @@ MAINTAINER Kolla Project (https://launchpad.net/kolla)
 RUN yum -y install openstack-heat-api-cfn \
     && yum clean all
 
-    {% elif base_distro in ['ubuntu', 'debian'] %}
-
-RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \
-    && /bin/false
-
     {% endif %}
 {% endif %}
 
diff --git a/docker/heat/heat-api/Dockerfile.j2 b/docker/heat/heat-api/Dockerfile.j2
index 1f798e51de..48bbda15d9 100644
--- a/docker/heat/heat-api/Dockerfile.j2
+++ b/docker/heat/heat-api/Dockerfile.j2
@@ -7,11 +7,6 @@ MAINTAINER Kolla Project (https://launchpad.net/kolla)
 RUN yum -y install openstack-heat-api \
     && yum clean all
 
-    {% elif base_distro in ['ubuntu', 'debian'] %}
-
-RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \
-    && /bin/false
-
     {% endif %}
 {% endif %}
 
diff --git a/docker/heat/heat-base/Dockerfile.j2 b/docker/heat/heat-base/Dockerfile.j2
index 44f62e1f73..0bbf3a53c6 100644
--- a/docker/heat/heat-base/Dockerfile.j2
+++ b/docker/heat/heat-base/Dockerfile.j2
@@ -4,15 +4,9 @@ MAINTAINER Kolla Project (https://launchpad.net/kolla)
 {% if install_type == 'binary' %}
     {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %}
 
-RUN yum -y install \
-    python-oslo-reports \
+RUN yum -y install python-oslo-reports \
     && yum clean all
 
-    {% elif base_distro in ['ubuntu', 'debian'] %}
-
-RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \
-    && /bin/false
-
     {% endif %}
 {% elif install_type == 'source' %}
 
diff --git a/docker/heat/heat-engine/Dockerfile.j2 b/docker/heat/heat-engine/Dockerfile.j2
index a46fba490a..495d2b3754 100644
--- a/docker/heat/heat-engine/Dockerfile.j2
+++ b/docker/heat/heat-engine/Dockerfile.j2
@@ -4,19 +4,14 @@ MAINTAINER Kolla Project (https://launchpad.net/kolla)
 {% if install_type == 'binary' %}
     {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %}
 
+# TODO(SamYaple): until packaging is fixed, all of the python clients below are required
+# http://pkgs.fedoraproject.org/cgit/openstack-heat.git/tree/openstack-heat.spec#n248
 RUN yum -y install \
-    # until http://pkgs.fedoraproject.org/cgit/openstack-heat.git/tree/openstack-heat.spec#n248 \
-    # is updated, the clients must remain here: \
-    python-barbicanclient \
-    python-zaqarclient \
-    openstack-heat-engine \
+        python-barbicanclient \
+        python-zaqarclient \
+        openstack-heat-engine \
     && yum clean all
 
-    {% elif base_distro in ['ubuntu', 'debian'] %}
-
-RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \
-    && /bin/false
-
     {% endif %}
 {% endif %}
 
diff --git a/docker/horizon/Dockerfile.j2 b/docker/horizon/Dockerfile.j2
index f9c341de29..790bef89da 100644
--- a/docker/horizon/Dockerfile.j2
+++ b/docker/horizon/Dockerfile.j2
@@ -21,14 +21,6 @@ RUN sed -i "s|WEBROOT = '/dashboard/'|WEBROOT = '/'|" /etc/openstack-dashboard/l
     && /usr/bin/python /usr/bin/manage.py collectstatic --noinput --clear \
     && /usr/bin/python /usr/bin/manage.py compress --force
 
-# djano-pyscss causes manage.py compress to fail as shipped with current
-# RDO.  Upgrading to latest version appears to get mange.py to work properly
-
-    {% elif base_distro in ['ubuntu', 'debian'] %}
-
-RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \
-    && /bin/false
-
     {% endif %}
 {% elif install_type == 'source' %}
     {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %}
diff --git a/docker/ironic/ironic-base/Dockerfile.j2 b/docker/ironic/ironic-base/Dockerfile.j2
index a283721d6a..cf6b53b7d3 100644
--- a/docker/ironic/ironic-base/Dockerfile.j2
+++ b/docker/ironic/ironic-base/Dockerfile.j2
@@ -4,19 +4,14 @@ MAINTAINER Kolla Project (https://launchpad.net/kolla)
 {% if install_type == 'binary' %}
     {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %}
 
-# until packaging is fixed, all of this is required
-# api: policy
+# TODO(SamYaple): until packaging is fixed, all of this is required
+# http://pkgs.fedoraproject.org/cgit/openstack-ironic.git/tree/openstack-ironic.spec#n78
 RUN yum -y install \
         python-oslo-log \
         python-oslo-concurrency \
         python-oslo-policy \
     && yum clean all
 
-    {% elif base_distro in ['ubuntu', 'debian'] %}
-
-RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \
-    && /bin/false
-
     {% endif %}
 {% elif install_type == 'source' %}
 
diff --git a/docker/keystone/Dockerfile.j2 b/docker/keystone/Dockerfile.j2
index 7d2aea70e0..067f16b899 100644
--- a/docker/keystone/Dockerfile.j2
+++ b/docker/keystone/Dockerfile.j2
@@ -15,20 +15,6 @@ RUN mkdir -p /var/www/cgi-bin/keystone \
     && cp -a /usr/share/keystone/keystone.wsgi /var/www/cgi-bin/keystone/admin \
     && sed -i -r 's,^(Listen 80),#\1,' /etc/httpd/conf/httpd.conf
 
-    {% elif base_distro in ['ubuntu', 'debian'] %}
-
-RUN apt-get install -y --no-install-recommends \
-        apache2 \
-        keystone \
-        libapache2-mod-wsgi \
-        python-keystoneclient \
-    && apt-get clean
-
-RUN ln -s /etc/apache2/sites-available/wsgi-keystone.conf /etc/apache2/sites-enabled \
-    && mkdir -p /var/www/cgi-bin/keystone \
-    && cp -a /usr/share/keystone/wsgi.py /var/www/cgi-bin/keystone/main \
-    && cp -a /usr/share/keystone/wsgi.py /var/www/cgi-bin/keystone/admin
-
     {% endif %}
 {% elif install_type == 'source' %}
     {% if base_distro in ['fedora', 'centos', 'oraclelinux', 'rhel'] %}
diff --git a/docker/magnum/magnum-base/Dockerfile.j2 b/docker/magnum/magnum-base/Dockerfile.j2
index aa81301b92..dc16cb4478 100644
--- a/docker/magnum/magnum-base/Dockerfile.j2
+++ b/docker/magnum/magnum-base/Dockerfile.j2
@@ -10,10 +10,10 @@ RUN curl https://copr.fedoraproject.org/coprs/sdake/openstack-magnum/repo/epel-7
 
 RUN curl https://copr.fedoraproject.org/coprs/sdake/openstack-magnum/repo/fedora-22/sdake-openstack-magnum-fedora-22.repo -o /etc/yum.repos.d/sdake-openstack-magnum-f22.repo
 
-     {% elif base_distro in ['ubuntu', 'debian', 'oraclelinux'] %}
+     {% elif base_distro in ['oraclelinux'] %}
 
 RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \
-  && /bin/false
+    && /bin/false
 
     {% endif %}
 {% elif install_type == 'source' %}
diff --git a/docker/murano/murano-base/Dockerfile.j2 b/docker/murano/murano-base/Dockerfile.j2
index 6564a87654..a05eb6fb83 100644
--- a/docker/murano/murano-base/Dockerfile.j2
+++ b/docker/murano/murano-base/Dockerfile.j2
@@ -1,12 +1,7 @@
 FROM {{ namespace }}/{{ base_distro }}-{{ install_type }}-openstack-base:{{ tag }}
 MAINTAINER Kolla Project (https://launchpad.net/kolla)
 
-{% if install_type == 'binary' %}
-
-RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \
-    && /bin/false
-
-{% elif install_type == 'source' %}
+{% if install_type == 'source' %}
 
 ADD murano-base-archive /murano-base-source
 RUN ln -s murano-base-source/* murano \
diff --git a/docker/neutron/neutron-base/Dockerfile.j2 b/docker/neutron/neutron-base/Dockerfile.j2
index e9a6ffb113..826a0788e6 100644
--- a/docker/neutron/neutron-base/Dockerfile.j2
+++ b/docker/neutron/neutron-base/Dockerfile.j2
@@ -4,20 +4,15 @@ MAINTAINER Kolla Project (https://launchpad.net.kolla)
 {% if install_type == 'binary' %}
     {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %}
 
-
-RUN yum -y install openstack-neutron \
-    openstack-neutron-ml2 \
-    openvswitch \
+RUN yum -y install \
+        openstack-neutron \
+        openstack-neutron-ml2 \
+        openvswitch \
     && yum clean all
 
 # TODO (sdake): remove once RDO adds to the openstack-neutron package
 RUN pip install oslo.versionedobjects
 
-    {% elif base_distro in ['ubuntu', 'debian'] %}
-
-RUN echo '{{ install_type}} not yet available for {{ base_distro }}' \
-    && /bin/false
-
     {% endif %}
 {% elif install_type == 'source' %}
     {% if base_distro in ['ubuntu', 'debian'] %}
diff --git a/docker/nova/nova-base/Dockerfile.j2 b/docker/nova/nova-base/Dockerfile.j2
index 293cbaeead..8032090aab 100644
--- a/docker/nova/nova-base/Dockerfile.j2
+++ b/docker/nova/nova-base/Dockerfile.j2
@@ -12,17 +12,11 @@ RUN yum -y install \
         bridge-utils \
     && yum clean all
 
-    {% elif base_distro in ['ubuntu', 'debian'] %}
-
-RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \
-    && /bin/false
-
     {% endif %}
 {% elif install_type == 'source' %}
     {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %}
 
-RUN yum -y install \
-        bridge-utils \
+RUN yum -y install bridge-utils \
     && yum clean all
 
     {% elif base_distro in ['ubuntu', 'debian'] %}
diff --git a/docker/swift/swift-base/Dockerfile.j2 b/docker/swift/swift-base/Dockerfile.j2
index 03c41c2bd9..df1ed30c90 100644
--- a/docker/swift/swift-base/Dockerfile.j2
+++ b/docker/swift/swift-base/Dockerfile.j2
@@ -4,15 +4,10 @@ MAINTAINER Kolla Project (https://launchpad.net.kolla)
 {% if install_type == 'binary' %}
     {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %}
 
-RUN yum -y install openstack-swift && yum clean all
-
-   {% elif base_distro in ['ubuntu', 'debian'] %}
-
-RUN echo '{{ install_type}} not yet available for {{ base_distro }}' \
-    && /bin/false
+RUN yum -y install openstack-swift \
+    && yum clean all
 
     {% endif %}
-
 {% elif install_type == 'source' %}
 
 ADD swift-base-archive /swift-base-source
diff --git a/docker/zaqar/Dockerfile.j2 b/docker/zaqar/Dockerfile.j2
index 5661744c21..2fe7766068 100644
--- a/docker/zaqar/Dockerfile.j2
+++ b/docker/zaqar/Dockerfile.j2
@@ -4,13 +4,8 @@ MAINTAINER Kolla Project (https://launchpad.net/kolla)
 {% if install_type == 'binary' %}
     {% if base_distro in ['centos', 'fedora', 'oraclelinux', 'rhel'] %}
 
-
-RUN yum -y install openstack-zaqar && yum clean all
-
-    {% elif base_distro in ['ubuntu', 'debian'] %}
-
-RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \
-    && /bin/false
+RUN yum -y install openstack-zaqar \
+    && yum clean all
 
     {% endif %}
 {% elif install_type == 'source' %}
-- 
GitLab