From e1b37f5444bae2400490917b697a18b03c90cace Mon Sep 17 00:00:00 2001 From: Dan Prince Date: Thu, 23 Aug 2018 14:51:03 -0400 Subject: [PATCH] Add a tripleoclient container We'd like to use this container both interactively (for ad-hoc commands) and also to be able to generate Ansible (via the undercloud/all-in-one installers) for TripleO. Partially-implements: https://blueprints.launchpad.net/tripleo/+spec/zero-footprint Change-Id: Ia4d7fdcb9c96d76e191dcc1a46be095b37189b3e --- docker/tripleoclient/Dockerfile.j2 | 40 +++++++++++++++++++ docker/tripleoclient/create_super_user.sh | 18 +++++++++ kolla/common/config.py | 4 ++ kolla/image/build.py | 6 +++ ...-tripleoclient-image-0341fb72fe27ba14.yaml | 5 +++ 5 files changed, 73 insertions(+) create mode 100644 docker/tripleoclient/Dockerfile.j2 create mode 100644 docker/tripleoclient/create_super_user.sh create mode 100644 releasenotes/notes/add-tripleoclient-image-0341fb72fe27ba14.yaml diff --git a/docker/tripleoclient/Dockerfile.j2 b/docker/tripleoclient/Dockerfile.j2 new file mode 100644 index 0000000000..37d8defc7a --- /dev/null +++ b/docker/tripleoclient/Dockerfile.j2 @@ -0,0 +1,40 @@ +FROM {{ namespace }}/{{ image_prefix }}openstack-base:{{ tag }} +LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}" + +{% block tripleoclient_header %}{% endblock %} + +{% import "macros.j2" as macros with context %} + +{% if install_type == 'binary' %} + {% if base_distro in ['centos', 'oraclelinux', 'rhel'] %} + + {% set tripleoclient_packages = [ + 'python-ipaddr', + 'python-openstackclient', + 'python-tripleoclient', + 'puppet-tripleo', + 'openstack-tripleo-validations', + 'e2fsprogs', + 'xfsprogs', + 'openssh-clients', + 'git' + ] %} + +{{ macros.install_packages(tripleoclient_packages | customizable("packages")) }} + + {% else %} +RUN echo 'tripleoclient not yet available for {{ base_distro }}' && /bin/false + {% endif %} + +{% elif install_type == 'source' %} + + +RUN echo 'tripleoclient not yet available for {{ base_distro }} source installs' && /bin/false + +{% endif %} + +COPY create_super_user.sh /usr/local/bin/create_super_user.sh +RUN chmod 750 /usr/local/bin/create_super_user.sh + +{% block tripleoclient_footer %}{% endblock %} +{% block footer %}{% endblock %} diff --git a/docker/tripleoclient/create_super_user.sh b/docker/tripleoclient/create_super_user.sh new file mode 100644 index 0000000000..37c8bf1df1 --- /dev/null +++ b/docker/tripleoclient/create_super_user.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# This is a useful entrypoint/cmd if you wish to run commands in a container +# in an existing users $HOME directory +# For example: docker run -ti -e USER=stack -e UID=1000 --privileged=true --volume=/home/stack/:/home/stack/ tripleoclient:latest /usr/local/bin/create_super_user.sh + +if [ -n "$USER" -a -n "$UID" ]; then + useradd "$USER" -u "$UID" -M +cat >> /etc/sudoers <