Remove centos and rhel elements

Several people have popped up in IRC recently with failures in these
elements.  Without Python 2.7 available in the image they are
unsupported (OpenStack hasn't supported it for a long time).  Remove
these to avoid further confusion.

The centos/centos7 DISTRO split that has happened with centos-minimal
is unfortunate but I don't think it helps to rename centos7/rhel7 ATM.
To summarise; DISTRO=centos7 means image based build,
DISTRO=centos && DIB_RELEASE=7 means the minimal build.

In the future, I think it is important that the minimal builds and
image builds set the same DISTRO.  This reflects that "upper" layers
shouldn't care about the exact building of the lower layers.  I see
CentOS 8 going one of two ways

1) the changes are so significant, we start separate centos8 /
centos8-minimal elements.  They both set DISTRO=centos8 (and
DIB_RELEASE to point-release maybe?).  This means we have to update
all "if DISTRO == centos || DISTRO == centos7" branches to also check
for "centos8".  Evenually (!)  "centos" goes away for versioned DISTRO
only

2) we restore centos element with DISTRO=centos and DIB_RELEASE=8, and
centos-minimal remains the same.  This means we have to audit all "if
DISTRO == centos" calls to make sure they're appropriate for version 8
(stick a "&& DIB_RELEASE=7" on them all basically).

I'm not sure we can fully decide until we start to see excatly how the
distro switching/matching bits look, but (2) is consistent with Ubuntu
and probably the preferred solution.

Some "rhel" parts have been cleaned up.  More could be done in
rhel-common, but given our lack of coverage of that I'd prefer to
leave it for now.

Change-Id: I6ea784116ef59ca22878c8512c963f29c815a00a
This commit is contained in:
Ian Wienand 2017-06-28 10:55:53 +10:00
parent cd5d08be89
commit a00d02f6a1
20 changed files with 17 additions and 273 deletions

View File

@ -1,6 +0,0 @@
======
centos
======
Use Centos 6 cloud images as the baseline for built disk images.
For further details see the redhat-common README.

View File

@ -1,4 +0,0 @@
cache-url
redhat-common
rpm-distro
yum

View File

@ -1 +0,0 @@
operating-system

View File

@ -1 +0,0 @@
export DIB_EXTLINUX=1

View File

@ -1,9 +0,0 @@
export DISTRO_NAME=centos
export DIB_RELEASE=${DIB_RELEASE:-GenericCloud}
# Useful for elements that work with fedora (dnf) & centos
export YUM=${YUM:-yum}
if [ -n "${DIB_CENTOS_DISTRIBUTION_MIRROR:-}" ]; then
export DIB_DISTRIBUTION_MIRROR=$DIB_CENTOS_DISTRIBUTION_MIRROR
fi

View File

@ -1,4 +0,0 @@
parted:
cloud-utils:
cloud-utils-growpart:
dracut-modules-growroot:

View File

@ -1,18 +0,0 @@
#!/bin/bash
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
DIB_DISTRIBUTION_MIRROR=${DIB_DISTRIBUTION_MIRROR:-http://mirror.centos.org/centos}
cat << EOF > /etc/yum.repos.d/centos6-latest.repo
[rhel6]
name=centos6
baseurl=$DIB_DISTRIBUTION_MIRROR/6/os/x86_64/
enabled=1
metadata_expire=7d
gpgcheck=0
EOF

View File

@ -1,33 +0,0 @@
#!/bin/bash
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
[ -n "$ARCH" ]
[ -n "$TARGET_ROOT" ]
if [ 'amd64' = "$ARCH" ] ; then
ARCH="x86_64"
fi
DIB_LOCAL_IMAGE=${DIB_LOCAL_IMAGE:-}
if [ -n "$DIB_LOCAL_IMAGE" ]; then
IMAGE_LOCATION=$DIB_LOCAL_IMAGE
# No need to copy a local image into the cache directory, so just specify
# the cached path as the original path.
CACHED_IMAGE=$IMAGE_LOCATION
BASE_IMAGE_FILE=$(basename $DIB_LOCAL_IMAGE)
BASE_IMAGE_TAR=$BASE_IMAGE_FILE.tgz
else
DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-http://cloud.centos.org/centos/6/images}
BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-CentOS-6-x86_64-$DIB_RELEASE.qcow2.xz}
BASE_IMAGE_TAR=$BASE_IMAGE_FILE.tgz
IMAGE_LOCATION=$DIB_CLOUD_IMAGES/$BASE_IMAGE_FILE
CACHED_IMAGE=$DIB_IMAGE_CACHE/$BASE_IMAGE_FILE
fi
$TMP_HOOKS_PATH/bin/extract-image $BASE_IMAGE_FILE $BASE_IMAGE_TAR $IMAGE_LOCATION $CACHED_IMAGE

View File

@ -23,10 +23,6 @@ else
RELEASE=7
URL=$BASE_URL/$RELEASE/x86_64/e/
;;
rhel)
RELEASE=6
URL=$BASE_URL/$RELEASE/$ARCH/
;;
*)
echo "$DISTRO_NAME is not supported"
exit 1

View File

@ -1,16 +1,4 @@
{
"distro": {
"rhel": {
"tgt": "targetcli",
"curl": "curl",
"ironic-python-agent": "openstack-ironic-python-agent"
},
"centos":{
"tgt": "scsi-target-utils",
"curl": "curl",
"ironic-python-agent": "openstack-ironic-python-agent"
}
},
"family": {
"redhat": {
"tgt": "scsi-target-utils",

View File

@ -6,7 +6,7 @@ fi
set -eu
set -o pipefail
if [[ $DISTRO_NAME =~ (opensuse|fedora|centos|centos7|rhel|rhel7) ]]; then
if [[ $DISTRO_NAME =~ (opensuse|fedora|centos|centos7|rhel7) ]]; then
_do_py3=0
packages="python-virtualenv python-pip python-setuptools"

View File

@ -1,26 +0,0 @@
====
rhel
====
# Overrides:
## General
* Downloading the Red Hat Enterprise Linux cloud image requires a valid Red Hat Network login and a subscription to Red Hat Enterprise Linux 6 Server product.
* diskimage-builder does not integrate directly with RHN, so a manual download is required. Please visit https://rhn.redhat.com/rhn/software/channel/downloads/Download.do?cid=16952 to download the qcow2 file.
* Set DIB_CLOUD_IMAGES to "file:///download_path"
* Overriding of DIB_RELEASE is necessary when a new version of the RHEL qcow2 image is available and the default image has not yet been updated in diskimage-builder.
## Red Hat Subscription Manager (RHSM)
Certificate-based Red Hat Subscription Management (RHSM) is the default registration type.
* Set DIB_RHSM_USER and DIB_RHSM_PASSWORD to register the system with RHSM during the image building process. This will apply the associated Red Hat Enterprise Linux Server subscription so the latest package updates can be applied. At the end of the image building process, the system will be unregistered from RHSM.
* Set DIB_RHSM_POOL to a subscription pool if you do not want the system to use the `--auto-attach` feature of `subscription-manager`.
* Set DIB_RHSM_REPOS to a space-separated list of Red Hat repositories to enable.
## Red Hat Network (RHN)
Set `DIB_REG_TYPE=rhn` for Red Hat Network (RHN classic) registration. The image building process will register the system to RHN and apply the associated Red Hat Enterprise Linux Server subscription so the latest package updates can be applied. At the end of the image building process, the system will be unregistered from RHN.
* For RHN username/password authentication set DIB_RHSM_USER and DIB_RHSM_PASSWORD. To use a Satellite server activation key set DIB_SAT_KEY. If adding RHN channels username and password must be set.
* When registering to Satellite set DIB_SAT_URL to the Satellite server URL and DIB_SAT_CERT_RPM_URL to the Satellite certificate.
* Set DIB_RHN_CHANNELS to a space-separated list of RHN channels to add. Example: `DIB_RHN_CHANNELS=rhel-x86_64-server-6 rhel-x86_64-server-6-rhscl-1`. RHN username/password is required for this.

View File

@ -1,65 +0,0 @@
#!/usr/bin/env python
#
# 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 __future__ import print_function
import sys
# Manually maintained for brevity; consider making this compiled from
# distromatch or other rich data sources.
# Debian name on the left, RHEL on the right.
#
# !!! DO NOT ADD ANY ENTRIES TO THIS FILE !!!
#
# This global list has been deprecated by the pkg-map element. New
# package mappings should go in pkg-map files inside each element.
#
package_map = {
'augeas-tools': 'augeas',
'build-essential': 'make automake gcc gcc-c++ kernel-devel',
'default-jre': 'java-1.7.0-openjdk',
'extlinux': 'syslinux-extlinux',
'gearman-job-server': 'gearmand',
'grub-pc': 'grub',
'libffi-dev': 'libffi-devel',
'libvirt-bin': 'libvirtd',
'libxml2-dev': 'libxml2-devel',
'libxslt-dev': 'libxslt-devel',
'libz-dev': 'zlib-devel',
'open-iscsi': 'iscsi-initiator-utils',
'openjdk-7-jre-headless': 'java-1.7.0-openjdk-headless',
'openssh-client': 'openssh-clients',
'python-dev': 'python-devel',
'stunnel4': 'stunnel',
'tftpd-hpa': 'tftp-server',
'tgt': 'scsi-target-utils',
'vlan': 'vconfig',
}
deprecated = []
for arg in sys.argv[1:]:
mapped = package_map.get(arg, arg)
if mapped != arg:
deprecated.append((arg, mapped))
print(mapped)
if deprecated:
print("WARNING: The following packages were re-mapped by "
"rhel map-packages.\n"
"They should be converted to pkg-map:\n", file=sys.stderr)
for arg, converted in deprecated:
print(" %s -> %s" % (arg, converted), file=sys.stderr)
sys.exit(0)

View File

@ -1,4 +0,0 @@
cache-url
rhel-common
rpm-distro
yum

View File

@ -1 +0,0 @@
operating-system

View File

@ -1 +0,0 @@
export DISTRO_NAME=rhel

View File

@ -1,17 +0,0 @@
#!/bin/bash
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
export DIB_RHSM_USER=${DIB_RHSM_USER:-}
if [ -n "$DIB_RHSM_USER" ] && [ -n "$DIB_RHSM_PASSWORD" ]; then
if [[ "$DIB_REG_TYPE" == "rhn" ]]; then
rm -rf /etc/sysconfig/rhn/systemid
else
subscription-manager unregister
fi
fi

View File

@ -1,65 +0,0 @@
#!/bin/bash
# dib-lint: disable=safe_sudo
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
[ -n "$ARCH" ]
[ -n "$TARGET_ROOT" ]
if [ 'amd64' = "$ARCH" ] ; then
ARCH="x86_64"
fi
DIB_RELEASE=${DIB_RELEASE:-"6.5-20140603.0"}
DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-http://rhn.redhat.com}
BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-rhel-guest-image-$DIB_RELEASE.x86_64.qcow2}
BASE_IMAGE_TAR=$DIB_RELEASE-rhel-server-$ARCH-latest.tgz
CACHED_TAR=$DIB_IMAGE_CACHE/$BASE_IMAGE_TAR
if [ -n "$DIB_OFFLINE" -a -f "$CACHED_TAR" ] ; then
echo "Not checking freshness of cached $CACHED_TAR."
else
echo "Fetching Base Image"
$TMP_HOOKS_PATH/bin/cache-url $DIB_CLOUD_IMAGES/$BASE_IMAGE_FILE $DIB_IMAGE_CACHE/$BASE_IMAGE_FILE
if [ ! -f $CACHED_TAR -o \
$DIB_IMAGE_CACHE/$BASE_IMAGE_FILE -nt $CACHED_TAR ] ; then
echo "Repacking base image as tarball."
WORKING=$(mktemp -d)
EACTION="rm -r $WORKING"
trap "$EACTION" EXIT
RAW_FILE=$(mktemp --tmpdir=$WORKING XXXXXX.raw)
qemu-img convert -f qcow2 -O raw $DIB_IMAGE_CACHE/$BASE_IMAGE_FILE $RAW_FILE
MAGIC_BIT=p1
# NOTE: On RHEL, partprobe of /dev/loop0 does not create /dev/loop0p2,
# while kpartx at least creates /dev/mapper/loop0p2.
LOOPDEV=$(sudo kpartx -av $RAW_FILE | awk "/loop[0-9]+$MAGIC_BIT/ {print \$3}")
# If running inside Docker, make our nodes manually, because udev will not be working.
if [ -f /.dockerenv ]; then
sudo dmsetup --noudevsync mknodes
fi
export LOOPDEV=$LOOPDEV
echo "Loop device is set to: $LOOPDEV"
if ! timeout 5 sh -c "while ! [ -e /dev/mapper/$LOOPDEV ]; do sleep 1; done"; then
echo "Error: Could not find /dev/mapper/$LOOPDEV"
exit 1
fi
EACTION="sudo kpartx -d $RAW_FILE;$EACTION"
trap "$EACTION" EXIT
mkdir $WORKING/mnt
sudo mount /dev/mapper/$LOOPDEV $WORKING/mnt
EACTION="sudo umount -f $WORKING/mnt;$EACTION"
trap "$EACTION" EXIT
# Chroot in so that we get the correct uid/gid
sudo chroot $WORKING/mnt bin/tar -cz . > $WORKING/tmp.tar
mv $WORKING/tmp.tar $DIB_IMAGE_CACHE/$BASE_IMAGE_TAR
fi
fi
# Extract the base image (use --numeric-owner to avoid UID/GID mismatch between
# image tarball and host OS e.g. when building RHEL image on an openSUSE host)
sudo tar -C $TARGET_ROOT --numeric-owner -xzf $DIB_IMAGE_CACHE/$BASE_IMAGE_TAR

View File

@ -0,0 +1,16 @@
---
deprecations:
- |
The ``centos`` and ``rhel`` elements have been removed. These
were building version 6 which is no longer supported (mostly due
to a lack of python 2.7). Version 7 support is available via the
``centos7`` and ``rhel7`` elements (which downloads and modifies
the upstream cloud images) or via ``centos-minimal`` (which builds
the image from a empty chroot; only available for CentOS).
``centos-minimal`` is suggested as this is what OpenStack
Infrastructure uses for its elements.
Unfortunately, ``centos-minimal`` sets ``DISTRO=centos`` while
``centos7`` sets ``DISTRO=centos7``, despite building the same
thing as far as upper levels are concerned. We plan to rectify
this in the version 8 time-frame.