Merge "Allow arbitrary source archive name to be imported into Dockerfile"
This commit is contained in:
commit
91bc4b094c
@ -10,8 +10,8 @@ RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% elif install_type == 'source' %}
|
{% elif install_type == 'source' %}
|
||||||
|
|
||||||
ADD ceilometer-base.tar /
|
ADD ceilometer-base-archive /ceilometer-base-source
|
||||||
RUN ln -s /ceilometer-* ceilometer \
|
RUN ln -s ceilometer-base-source/* ceilometer \
|
||||||
&& useradd --user-group ceilometer \
|
&& useradd --user-group ceilometer \
|
||||||
&& pip --no-cache-dir install /ceilometer \
|
&& pip --no-cache-dir install /ceilometer \
|
||||||
&& mkdir -p /etc/ceilometer /var/log/ceilometer /home/ceilometer \
|
&& mkdir -p /etc/ceilometer /var/log/ceilometer /home/ceilometer \
|
||||||
|
@ -33,8 +33,8 @@ RUN apt-get install -y --no-install-recommends lvm2 \
|
|||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
ADD cinder-base.tar /
|
ADD cinder-base-archive /cinder-base-source
|
||||||
RUN ln -s /cinder-* cinder \
|
RUN ln -s cinder-base-source/* cinder \
|
||||||
&& useradd --user-group cinder \
|
&& useradd --user-group cinder \
|
||||||
&& pip --no-cache-dir install /cinder \
|
&& pip --no-cache-dir install /cinder \
|
||||||
&& mkdir -p /etc/cinder /var/log/cinder /home/cinder \
|
&& mkdir -p /etc/cinder /var/log/cinder /home/cinder \
|
||||||
|
@ -25,8 +25,8 @@ RUN echo '{{ install_type}} not yet available for {{ base_distro }}' \
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% elif install_type == 'source' %}
|
{% elif install_type == 'source' %}
|
||||||
|
|
||||||
ADD designate-base.tar /
|
ADD designate-base-archive /designate-base-source
|
||||||
RUN ln -s /designate-* designate \
|
RUN ln -s designate-base-source/* designate \
|
||||||
&& useradd --user-group designate \
|
&& useradd --user-group designate \
|
||||||
&& pip --no-cache-dir install /designate \
|
&& pip --no-cache-dir install /designate \
|
||||||
&& mkdir -p /etc/designate /var/log/designate /home/designate \
|
&& mkdir -p /etc/designate /var/log/designate /home/designate \
|
||||||
|
@ -17,8 +17,8 @@ RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% elif install_type == 'source' %}
|
{% elif install_type == 'source' %}
|
||||||
|
|
||||||
ADD glance-base.tar /
|
ADD glance-base-archive /glance-base-source
|
||||||
RUN ln -s /glance-* glance \
|
RUN ln -s glance-base-source/* glance \
|
||||||
&& useradd --user-group glance \
|
&& useradd --user-group glance \
|
||||||
&& pip --no-cache-dir install /glance \
|
&& pip --no-cache-dir install /glance \
|
||||||
&& mkdir -p /etc/glance /var/log/glance /home/glance \
|
&& mkdir -p /etc/glance /var/log/glance /home/glance \
|
||||||
|
@ -14,8 +14,8 @@ RUN apt-get install -y --no-install-recommends libpq-dev \
|
|||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
ADD gnocchi-base.tar /
|
ADD gnocchi-base-archive /gnocchi-base-source
|
||||||
RUN ln -s /gnocchi-* gnocchi \
|
RUN ln -s gnocchi-base-source/* gnocchi \
|
||||||
&& useradd --user-group gnocchi \
|
&& useradd --user-group gnocchi \
|
||||||
&& pip --no-cache-dir install /gnocchi \
|
&& pip --no-cache-dir install /gnocchi \
|
||||||
&& mkdir -p /etc/gnocchi /var/log/gnocchi /home/gnocchi \
|
&& mkdir -p /etc/gnocchi /var/log/gnocchi /home/gnocchi \
|
||||||
|
@ -16,8 +16,8 @@ RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% elif install_type == 'source' %}
|
{% elif install_type == 'source' %}
|
||||||
|
|
||||||
ADD heat-base.tar /
|
ADD heat-base-archive /heat-base-source
|
||||||
RUN ln -s /heat-* heat \
|
RUN ln -s heat-base-source/* heat \
|
||||||
&& useradd --user-group heat \
|
&& useradd --user-group heat \
|
||||||
&& pip --no-cache-dir install /heat \
|
&& pip --no-cache-dir install /heat \
|
||||||
&& mkdir -p /etc/heat /var/log/heat /home/heat \
|
&& mkdir -p /etc/heat /var/log/heat /home/heat \
|
||||||
|
@ -50,8 +50,8 @@ RUN apt-get install -y --no-install-recommends \
|
|||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
ADD horizon.tar /
|
ADD horizon-archive /horizon-source
|
||||||
RUN ln -s /horizon-* horizon \
|
RUN ln -s horizon-source/* horizon \
|
||||||
&& pip --no-cache-dir install /horizon \
|
&& pip --no-cache-dir install /horizon \
|
||||||
&& useradd --user-group horizon \
|
&& useradd --user-group horizon \
|
||||||
&& mkdir -p /etc/openstack-dashboard /home/horizon \
|
&& mkdir -p /etc/openstack-dashboard /home/horizon \
|
||||||
|
@ -20,8 +20,8 @@ RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% elif install_type == 'source' %}
|
{% elif install_type == 'source' %}
|
||||||
|
|
||||||
ADD ironic-base.tar /
|
ADD ironic-base-archive /ironic-base-source
|
||||||
RUN ln -s /ironic-* ironic \
|
RUN ln -s ironic-base-source/* ironic \
|
||||||
&& useradd --user-group ironic \
|
&& useradd --user-group ironic \
|
||||||
&& pip --no-cache-dir install /ironic \
|
&& pip --no-cache-dir install /ironic \
|
||||||
&& mkdir -p /etc/ironic /var/log/ironic /home/ironic \
|
&& mkdir -p /etc/ironic /var/log/ironic /home/ironic \
|
||||||
|
@ -49,8 +49,8 @@ RUN apt-get install -y --no-install-recommends \
|
|||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
ADD keystone.tar /
|
ADD keystone-archive /keystone-source
|
||||||
RUN ln -s /keystone-* keystone \
|
RUN ln -s keystone-source/* keystone \
|
||||||
&& useradd --user-group keystone \
|
&& useradd --user-group keystone \
|
||||||
&& pip --no-cache-dir install /keystone \
|
&& pip --no-cache-dir install /keystone \
|
||||||
&& mkdir -p /etc/keystone /var/www/cgi-bin/keystone /var/log/apache2 /home/keystone \
|
&& mkdir -p /etc/keystone /var/www/cgi-bin/keystone /var/log/apache2 /home/keystone \
|
||||||
|
@ -18,8 +18,8 @@ RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% elif install_type == 'source' %}
|
{% elif install_type == 'source' %}
|
||||||
|
|
||||||
ADD magnum-base.tar /
|
ADD magnum-base-archive /magnum-base-source
|
||||||
RUN ln -s /magnum-* magnum \
|
RUN ln -s magnum-base-source/* magnum \
|
||||||
&& useradd --user-group magnum \
|
&& useradd --user-group magnum \
|
||||||
&& pip --no-cache-dir install /magnum \
|
&& pip --no-cache-dir install /magnum \
|
||||||
&& mkdir -p /etc/magnum /var/log/magnum /home/magnum \
|
&& mkdir -p /etc/magnum /var/log/magnum /home/magnum \
|
||||||
|
@ -8,8 +8,8 @@ RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \
|
|||||||
|
|
||||||
{% elif install_type == 'source' %}
|
{% elif install_type == 'source' %}
|
||||||
|
|
||||||
ADD murano-base.tar /
|
ADD murano-base-archive /murano-base-source
|
||||||
RUN ln -s /murano-* murano \
|
RUN ln -s murano-base-source/* murano \
|
||||||
&& useradd --user-group murano \
|
&& useradd --user-group murano \
|
||||||
&& pip --no-cache-dir install /murano \
|
&& pip --no-cache-dir install /murano \
|
||||||
&& mkdir -p /etc/murano /var/log/murano /home/murano \
|
&& mkdir -p /etc/murano /var/log/murano /home/murano \
|
||||||
|
@ -31,8 +31,8 @@ RUN apt-get install -y --no-install-recommends \
|
|||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
ADD neutron-base.tar /
|
ADD neutron-base-archive /neutron-base-source
|
||||||
RUN ln -s /neutron-* neutron \
|
RUN ln -s neutron-base-source/* neutron \
|
||||||
&& useradd --user-group neutron \
|
&& useradd --user-group neutron \
|
||||||
&& pip --no-cache-dir install /neutron \
|
&& pip --no-cache-dir install /neutron \
|
||||||
&& mkdir -p /etc/neutron /usr/share/neutron /var/log/neutron /home/neutron \
|
&& mkdir -p /etc/neutron /usr/share/neutron /var/log/neutron /home/neutron \
|
||||||
|
@ -39,8 +39,8 @@ RUN apt-get install -y --no-install-recommends \
|
|||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
ADD nova-base.tar /
|
ADD nova-base-archive /nova-base-source
|
||||||
RUN ln -s /nova-* nova \
|
RUN ln -s nova-base-source/* nova \
|
||||||
&& useradd --user-group nova \
|
&& useradd --user-group nova \
|
||||||
&& pip --no-cache-dir install /nova \
|
&& pip --no-cache-dir install /nova \
|
||||||
&& mkdir -p /etc/nova /var/log/nova /home/nova \
|
&& mkdir -p /etc/nova /var/log/nova /home/nova \
|
||||||
|
@ -12,8 +12,8 @@ RUN yum -y install \
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% elif install_type == 'source' %}
|
{% elif install_type == 'source' %}
|
||||||
|
|
||||||
ADD nova-novncproxy.tar /
|
ADD nova-novncproxy-archive /nova-novncproxy-source
|
||||||
RUN ln -s /kanaka-noVNC-* /usr/share/novnc
|
RUN ln -s nova-novncproxy-source/* /usr/share/novnc
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
@ -15,8 +15,8 @@ RUN echo '{{ install_type}} not yet available for {{ base_distro }}' \
|
|||||||
|
|
||||||
{% elif install_type == 'source' %}
|
{% elif install_type == 'source' %}
|
||||||
|
|
||||||
ADD swift-base.tar /
|
ADD swift-base-archive /swift-base-source
|
||||||
RUN ln -s /swift-* swift \
|
RUN ln -s swift-base-source/* swift \
|
||||||
&& useradd --user-group swift \
|
&& useradd --user-group swift \
|
||||||
&& pip --no-cache-dir install /swift \
|
&& pip --no-cache-dir install /swift \
|
||||||
&& mkdir -p /etc/swift /var/log/swift /home/swift \
|
&& mkdir -p /etc/swift /var/log/swift /home/swift \
|
||||||
|
@ -14,8 +14,8 @@ RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% elif install_type == 'source' %}
|
{% elif install_type == 'source' %}
|
||||||
|
|
||||||
ADD zaqar.tar /
|
ADD zaqar-archive /zaqar-source
|
||||||
RUN ln -s /zaqar-* zaqar \
|
RUN ln -s zaqar-source/* zaqar \
|
||||||
&& useradd --user-group zaqar \
|
&& useradd --user-group zaqar \
|
||||||
&& pip --no-cache-dir install /zaqar \
|
&& pip --no-cache-dir install /zaqar \
|
||||||
&& mkdir -p /etc/zaqar /var/log/zaqar /home/zaqar \
|
&& mkdir -p /etc/zaqar /var/log/zaqar /home/zaqar \
|
||||||
|
@ -88,27 +88,25 @@ class WorkerThread(Thread):
|
|||||||
|
|
||||||
def process_source(self, image):
|
def process_source(self, image):
|
||||||
source = image['source']
|
source = image['source']
|
||||||
dest_dir = image['path']
|
dest_archive = os.path.join(image['path'], image['name'] + '-archive')
|
||||||
dest_tar = os.path.join(dest_dir, image['name'] + '.tar')
|
|
||||||
|
|
||||||
if source.get('type') == 'url':
|
if source.get('type') == 'url':
|
||||||
LOG.debug("{}:Getting tarball from {}".format(image['name'],
|
LOG.debug("{}:Getting archive from {}".format(image['name'],
|
||||||
source['source']))
|
source['source']))
|
||||||
r = requests.get(source['source'])
|
r = requests.get(source['source'])
|
||||||
|
|
||||||
if r.status_code == 200:
|
if r.status_code == 200:
|
||||||
with open(dest_tar, 'wb') as f:
|
with open(dest_archive, 'wb') as f:
|
||||||
f.write(r.content)
|
f.write(r.content)
|
||||||
else:
|
else:
|
||||||
LOG.error(
|
LOG.error(
|
||||||
'{}:Failed to download tarball: status_code {}'.format(
|
'{}:Failed to download archive: status_code {}'.format(
|
||||||
image['name'], r.status_code))
|
image['name'], r.status_code))
|
||||||
image['status'] = "error"
|
image['status'] = "error"
|
||||||
return
|
return
|
||||||
|
|
||||||
elif source.get('type') == 'git':
|
elif source.get('type') == 'git':
|
||||||
clone_dir = os.path.splitext(dest_tar)[0] + \
|
clone_dir = dest_archive + '-' + source['reference']
|
||||||
'-' + source['reference']
|
|
||||||
try:
|
try:
|
||||||
LOG.debug("{}:Cloning from {}".format(image['name'],
|
LOG.debug("{}:Cloning from {}".format(image['name'],
|
||||||
source['source']))
|
source['source']))
|
||||||
@ -125,7 +123,7 @@ class WorkerThread(Thread):
|
|||||||
image['status'] = "error"
|
image['status'] = "error"
|
||||||
return
|
return
|
||||||
|
|
||||||
with tarfile.open(dest_tar, 'w') as tar:
|
with tarfile.open(dest_archive, 'w') as tar:
|
||||||
tar.add(clone_dir, arcname=os.path.basename(clone_dir))
|
tar.add(clone_dir, arcname=os.path.basename(clone_dir))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
@ -134,8 +132,8 @@ class WorkerThread(Thread):
|
|||||||
image['status'] = "error"
|
image['status'] = "error"
|
||||||
return
|
return
|
||||||
|
|
||||||
# Set time on destination tarball to epoch 0
|
# Set time on destination archive to epoch 0
|
||||||
os.utime(dest_tar, (0, 0))
|
os.utime(dest_archive, (0, 0))
|
||||||
|
|
||||||
def builder(self, image):
|
def builder(self, image):
|
||||||
LOG.debug('{}:Processing'.format(image['name']))
|
LOG.debug('{}:Processing'.format(image['name']))
|
||||||
|
Loading…
Reference in New Issue
Block a user