Split dockerfile to have an intermediate image w/ all Python deps

Fix some issues in bootdata implementation
This commit is contained in:
Scott Hussey 2017-06-22 13:19:11 -05:00
parent ab03692a81
commit 56fa2d3d17
7 changed files with 54 additions and 17 deletions

View File

@ -11,17 +11,13 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
FROM ubuntu:16.04 FROM drydock_base:0.1
ENV DEBIAN_FRONTEND noninteractive ENV DEBIAN_FRONTEND noninteractive
ENV container docker ENV container docker
RUN apt -qq update && \ ADD drydock.conf /etc/drydock/drydock.conf
apt -y install git netbase python3-minimal python3-setuptools python3-pip python3-dev ca-certificates gcc g++ make libffi-dev libssl-dev --no-install-recommends ADD . /tmp/drydock
# Need to configure proxies?
RUN git clone https://github.com/sh8121att/drydock /tmp/drydock
WORKDIR /tmp/drydock WORKDIR /tmp/drydock
@ -29,4 +25,4 @@ RUN python3 setup.py install
EXPOSE 9000 EXPOSE 9000
CMD ["/usr/bin/uwsgi","--http",":9000","-w","drydock_provisioner.drydock","--callable","drydock","--enable-threads","-L"] CMD ["uwsgi","--http",":9000","-w","drydock_provisioner.drydock","--callable","drydock","--enable-threads","-L","--pyargv","--config-file /etc/drydock/drydock.conf"]

27
Dockerfile.inter Normal file
View File

@ -0,0 +1,27 @@
# Copyright 2017 AT&T Intellectual Property. All other rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
FROM ubuntu:16.04
ENV DEBIAN_FRONTEND noninteractive
ENV container docker
RUN apt -qq update && \
apt -y install git netbase python3-minimal python3-setuptools python3-pip python3-dev ca-certificates gcc g++ make libffi-dev libssl-dev --no-install-recommends
# Need to configure proxies?
ADD requirements.txt /tmp/drydock/requirements.txt
WORKDIR /tmp/drydock
RUN pip3 install -r requirements.txt

View File

@ -15,6 +15,7 @@ import falcon
from .designs import * from .designs import *
from .tasks import * from .tasks import *
from .bootdata import *
from .base import DrydockRequest from .base import DrydockRequest
from .middleware import AuthMiddleware, ContextMiddleware, LoggingMiddleware from .middleware import AuthMiddleware, ContextMiddleware, LoggingMiddleware
@ -45,7 +46,7 @@ def start_api(state_manager=None, ingester=None, orchestrator=None):
('/designs/{design_id}/parts/{kind}/{name}', DesignsPartResource(state_manager=state_manager, orchestrator=orchestrator)), ('/designs/{design_id}/parts/{kind}/{name}', DesignsPartResource(state_manager=state_manager, orchestrator=orchestrator)),
# API for nodes to discover their bootdata during curtin install # API for nodes to discover their bootdata during curtin install
('/bootdata/{hostname}/{data_key}', BootdataResource(state_manager=state_manager)) ('/bootdata/{hostname}/{data_key}', BootdataResource(state_manager=state_manager, orchestrator=orchestrator))
] ]
for path, res in v1_0_routes: for path, res in v1_0_routes:

View File

@ -28,7 +28,7 @@ class BootdataResource(StatefulResource):
resp.body = BootdataResource.systemd_definition resp.body = BootdataResource.systemd_definition
resp.content_type = 'text/plain' resp.content_type = 'text/plain'
return return
elif data_key == 'prominit' elif data_key == 'prominit':
resp.boy = BootdataResource.prominit resp.boy = BootdataResource.prominit
resp.content_type = 'text/plain' resp.content_type = 'text/plain'
return return

View File

@ -70,7 +70,15 @@ class Ingester(object):
def ingest_data(self, plugin_name='', design_state=None, design_id=None, context=None, **kwargs): def ingest_data(self, plugin_name='', design_state=None, design_id=None, context=None, **kwargs):
"""
ingest_data - Execute a data ingestion using the named plugin (assuming it is enabled)
:param plugin_name: - Which plugin should be used for ingestion
:param design_state: - An instance of statemgmt.DesignState
:param design_id: - The ID of the SiteDesign all parsed designed parts should be added
:param context: - Context of the request requesting ingestion
:param kwargs: - Keywork arguments to pass to the ingester plugin
"""
if design_state is None: if design_state is None:
self.logger.error("Ingester:ingest_data called without valid DesignState handler") self.logger.error("Ingester:ingest_data called without valid DesignState handler")
raise ValueError("Invalid design_state handler") raise ValueError("Invalid design_state handler")

View File

@ -229,7 +229,7 @@ class DesignState(object):
parts = self.promenade.get(target, None) parts = self.promenade.get(target, None)
if parts is not None: if parts is not None:
return [p.obj_to_primitive() for p in parts] return [objects.PromenadeConfig.obj_from_primitive(p) for p in parts]
else: else:
return None return None

View File

@ -1,5 +1,10 @@
PyYAML==3.12 PyYAML
oauth==1.0.1 pyghmi>=1.0.18
requests-oauthlib==0.8.0 netaddr
netaddr==0.7.19 falcon
python-libmaas==0.4.1 oslo.versionedobjects>=1.23.0
requests
oauthlib
uwsgi>1.4
bson===0.4.7
oslo.config===4.6.0