Correct image prep for minimal containers

Both CentOS and SUSE have pathing and services that are assumed to exist
from our previous use of the larger LXC images. This change also ensures
netbase is installed across our supported distros.

* Imports the "rpm-gpg" packages if the directory exists.
* unmasks the "sshd" sevice on SUSE if present and masked or disabled.
* Adds the (setup|netbase|netcfg) packages to the base image

Change-Id: Idc5caf2030c0e50dfeb84e0648bec08d7f50b6b8
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
Kevin Carter 2018-03-22 22:11:58 -05:00 committed by Kevin Carter (cloudnull)
parent e44df830ef
commit a1a316f22e
5 changed files with 14 additions and 3 deletions

View File

@ -5,7 +5,9 @@ set -e -x
{% include 'templates/prep-scripts/_container_sys_setup.sh.j2' %}
rpm --import /etc/pki/rpm-gpg/*
if [[ -d "/etc/pki/rpm-gpg" ]]; then
rpm --import /etc/pki/rpm-gpg/* || true
fi
# The containers do not need the LXC repository (only hosts need it).
rm -f /etc/yum.repos.d/thm-lxc2.0*

View File

@ -23,8 +23,11 @@ chage -I -1 -d -1 -m 0 -M 99999 -E -1 root
# NOTE(hwoarang): Enable sshd which has been explicitely disabled in
# https://github.com/lxc/lxc-ci/commit/8dc7105399350a59698538a12b6d5a1a880ef2ba
systemctl -q unmask sshd
systemctl -q enable sshd
if systemctl list-unit-files sshd.service | egrep '(masked|disabled)'; then
systemctl -q unmask sshd
systemctl -q enable sshd
fi
rm /etc/machine-id || true
rm /var/lib/dbus/machine-id || true
touch /etc/machine-id

View File

@ -22,6 +22,7 @@ _lxc_cache_map:
copy_from_host:
- /etc/environment
- /etc/localtime
- /etc/protocols
- /etc/pki/rpm-gpg/
- /etc/yum/pluginconf.d/fastestmirror.conf
- /etc/yum.repos.d/
@ -42,6 +43,7 @@ _lxc_cache_distro_packages:
- python2
- python-devel
- rsync
- setup
- sudo
- systemd
- systemd-sysv

View File

@ -24,6 +24,7 @@ _lxc_cache_map:
copy_from_host:
- /etc/environment
- /etc/localtime
- /etc/protocols
- /etc/zypp/repos.d/repo-oss.repo
- /etc/zypp/repos.d/repo-update.repo
@ -38,6 +39,7 @@ _lxc_cache_distro_packages:
- iputils
- libffi-devel
- libopenssl-devel
- netcfg
- openssh
- openssl
- python

View File

@ -26,6 +26,7 @@ _lxc_cache_map:
- /etc/environment
- /etc/localtime
- /root/repo.keys
- /etc/protocols
_lxc_cache_prep_template: "prep-scripts/ubuntu_16_prep.sh.j2"
@ -39,6 +40,7 @@ _lxc_cache_distro_packages:
- iputils-ping
- libffi-dev
- libssl-dev
- netbase
- openssh-server
- openssl
- python2.7