Merge "Remove yum chroot caching"

This commit is contained in:
Jenkins 2017-01-17 01:10:41 +00:00 committed by Gerrit Code Review
commit f3d0d6e8ec
5 changed files with 106 additions and 121 deletions

View File

@ -6,13 +6,9 @@ Create a minimal image based on CentOS 7.
Use of this element will require 'yum' and 'yum-utils' to be installed on Use of this element will require 'yum' and 'yum-utils' to be installed on
Ubuntu and Debian. Nothing additional is needed on Fedora or CentOS. Ubuntu and Debian. Nothing additional is needed on Fedora or CentOS.
The `DIB_OFFLINE` or more specific `DIB_YUMCHROOT_USE_CACHE` By default, ``DIB_YUM_MINIMAL_CREATE_INTERFACES`` is set to enable the
variables can be set to prefer the use of a pre-cached root filesystem creation of ``/etc/sysconfig/network-scripts/ifcfg-eth[0|1]`` scripts to
tarball. enable DHCP on the ``eth0`` & ``eth1`` interfaces. If you do not have
By default, `DIB_YUM_MINIMAL_CREATE_INTERFACES` is set to enable the
creation of `/etc/sysconfig/network-scripts/ifcfg-eth[0|1]` scripts to
enable DHCP on the `eth0` & `eth1` interfaces. If you do not have
these interfaces, or if you are using something else to setup the these interfaces, or if you are using something else to setup the
network such as cloud-init, glean or network-manager, you would want network such as cloud-init, glean or network-manager, you would want
to set this to `0`. to set this to ``0``.

View File

@ -11,10 +11,6 @@ Due to a bug in the released version of urlgrabber, on many systems an
installation of urlgrabber from git is required. The git repository installation of urlgrabber from git is required. The git repository
can be found here: http://yum.baseurl.org/gitweb?p=urlgrabber.git;a=summary can be found here: http://yum.baseurl.org/gitweb?p=urlgrabber.git;a=summary
The `DIB_OFFLINE` or more specific `DIB_YUMCHROOT_USE_CACHE` This element sets the ``DIB_RELEASE`` var to 'fedora'. The release of
variables can be set to prefer the use of a pre-cached root filesystem fedora to be installed can be controlled through the ``DIB_RELEASE``
tarball. variable, which defaults the latest supported release.
This element sets the `DIB_RELEASE` var to 'fedora'. The release of fedora
to be installed can be controlled through the `DIB_RELEASE` variable, which
defaults to '21'.

View File

@ -9,10 +9,6 @@ or fedora-minimal elements to get an actual base image.
Use of this element will require 'yum' and 'yum-utils' to be installed on Use of this element will require 'yum' and 'yum-utils' to be installed on
Ubuntu and Debian. Nothing additional is needed on Fedora or CentOS. Ubuntu and Debian. Nothing additional is needed on Fedora or CentOS.
The `DIB_OFFLINE` or more specific `DIB_YUMCHROOT_USE_CACHE`
variables can be set to prefer the use of a pre-cached root filesystem
tarball.
If you wish to have DHCP networking setup for eth0 & eth1 via If you wish to have DHCP networking setup for eth0 & eth1 via
/etc/sysconfig/network-config scripts/ifcfg-eth[0|1], set the /etc/sysconfig/network-config scripts/ifcfg-eth[0|1], set the
environment variable `DIB_YUM_MINIMAL_CREATE_INTERFACES` to `1`. environment variable `DIB_YUM_MINIMAL_CREATE_INTERFACES` to `1`.

View File

@ -31,8 +31,6 @@ if [ $ARCH = amd64 ]; then
ARCH=x86_64 ARCH=x86_64
fi fi
# Calling elements will need to set DISTRO_NAME and DIB_RELEASE # Calling elements will need to set DISTRO_NAME and DIB_RELEASE
DIB_YUMCHROOT_EXTRA_ARGS=${DIB_YUMCHROOT_EXTRA_ARGS:-}
YUMCHROOT_TARBALL=$DIB_IMAGE_CACHE/yumchroot-${DISTRO_NAME}-${DIB_RELEASE}-${ARCH}.tar.gz
# TODO Maybe deal with DIB_DISTRIBUTION_MIRROR # TODO Maybe deal with DIB_DISTRIBUTION_MIRROR
http_proxy=${http_proxy:-} http_proxy=${http_proxy:-}
YUM=${YUM:-yum} YUM=${YUM:-yum}
@ -189,10 +187,6 @@ function _install_pkg_manager {
$TARGET_ROOT/etc/yum.repos.d/*repo $TARGET_ROOT/etc/yum.repos.d/*repo
} }
if [ -n "$DIB_OFFLINE" -o -n "${DIB_YUMCHROOT_USE_CACHE:-}" ] && [ -f $YUMCHROOT_TARBALL ] ; then
echo $YUMCHROOT_TARBALL found in cache. Using.
sudo tar -C $TARGET_ROOT --numeric-owner -xzf $YUMCHROOT_TARBALL
else
# Note this is not usually done for root.d elements (see # Note this is not usually done for root.d elements (see
# lib/common-functions:mount_proc_dev_sys) but it's important that # lib/common-functions:mount_proc_dev_sys) but it's important that
# we have things like /dev/urandom around inside the chroot for # we have things like /dev/urandom around inside the chroot for
@ -286,10 +280,4 @@ else
sudo mv $newfile $(echo $newfile | sed 's/.rpmnew$//') sudo mv $newfile $(echo $newfile | sed 's/.rpmnew$//')
done done
echo Caching result in $YUMCHROOT_TARBALL
sudo tar --numeric-owner \
-C $TARGET_ROOT \
-zcf $YUMCHROOT_TARBALL --exclude='./tmp/*' .
fi
sudo rm -f ${TARGET_ROOT}/.extra_settings sudo rm -f ${TARGET_ROOT}/.extra_settings

View File

@ -0,0 +1,9 @@
---
deprecations:
- The ``DIB_YUMCHROOT_USE_CACHE`` variable has been removed and the
Fedora and CentOS ``-minimal`` initial chroot will always be
created by the package manager. The default creation of a chroot
tarball is stopped for these elements. This unused option was
unsafe; there is no guarantee that the base system will not change
even between runs. Getting the package manager to reuse the cache
for the initial chroot install is future work.