From a00d02f6a1573ee8257105ebc18bcaba92e78ff8 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Wed, 28 Jun 2017 10:55:53 +1000 Subject: [PATCH] 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 --- diskimage_builder/elements/centos/README.rst | 6 -- .../elements/centos/element-deps | 4 -- .../elements/centos/element-provides | 1 - .../centos/environment.d/00-bootloader.bash | 1 - .../environment.d/10-centos6-distro-name.bash | 9 --- .../elements/centos/package-installs.yaml | 4 -- .../centos/pre-install.d/02-yum-repos | 18 ----- .../centos/root.d/10-centos6-cloud-image | 33 ---------- .../test-elements/build-succeeds/element-deps | 1 - .../epel/pre-install.d/05-rpm-epel-release | 4 -- .../elements/ironic-agent/pkg-map | 12 ---- .../04-install-pip | 2 +- diskimage_builder/elements/rhel/README.rst | 26 -------- .../elements/rhel/bin/map-packages | 65 ------------------- diskimage_builder/elements/rhel/element-deps | 4 -- .../elements/rhel/element-provides | 1 - .../environment.d/10-rhel-distro-name.bash | 1 - .../rhel/finalise.d/60-rhsm-unregister | 17 ----- .../elements/rhel/root.d/10-rhel-cloud-image | 65 ------------------- .../centos-retired-f17ae9f6f03e57e3.yaml | 16 +++++ 20 files changed, 17 insertions(+), 273 deletions(-) delete mode 100644 diskimage_builder/elements/centos/README.rst delete mode 100644 diskimage_builder/elements/centos/element-deps delete mode 100644 diskimage_builder/elements/centos/element-provides delete mode 100644 diskimage_builder/elements/centos/environment.d/00-bootloader.bash delete mode 100644 diskimage_builder/elements/centos/environment.d/10-centos6-distro-name.bash delete mode 100644 diskimage_builder/elements/centos/package-installs.yaml delete mode 100755 diskimage_builder/elements/centos/pre-install.d/02-yum-repos delete mode 100755 diskimage_builder/elements/centos/root.d/10-centos6-cloud-image delete mode 100644 diskimage_builder/elements/centos/test-elements/build-succeeds/element-deps delete mode 100644 diskimage_builder/elements/rhel/README.rst delete mode 100755 diskimage_builder/elements/rhel/bin/map-packages delete mode 100644 diskimage_builder/elements/rhel/element-deps delete mode 100644 diskimage_builder/elements/rhel/element-provides delete mode 100644 diskimage_builder/elements/rhel/environment.d/10-rhel-distro-name.bash delete mode 100755 diskimage_builder/elements/rhel/finalise.d/60-rhsm-unregister delete mode 100755 diskimage_builder/elements/rhel/root.d/10-rhel-cloud-image create mode 100644 releasenotes/notes/centos-retired-f17ae9f6f03e57e3.yaml diff --git a/diskimage_builder/elements/centos/README.rst b/diskimage_builder/elements/centos/README.rst deleted file mode 100644 index a044d089..00000000 --- a/diskimage_builder/elements/centos/README.rst +++ /dev/null @@ -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. diff --git a/diskimage_builder/elements/centos/element-deps b/diskimage_builder/elements/centos/element-deps deleted file mode 100644 index b13647d2..00000000 --- a/diskimage_builder/elements/centos/element-deps +++ /dev/null @@ -1,4 +0,0 @@ -cache-url -redhat-common -rpm-distro -yum diff --git a/diskimage_builder/elements/centos/element-provides b/diskimage_builder/elements/centos/element-provides deleted file mode 100644 index a72e0496..00000000 --- a/diskimage_builder/elements/centos/element-provides +++ /dev/null @@ -1 +0,0 @@ -operating-system diff --git a/diskimage_builder/elements/centos/environment.d/00-bootloader.bash b/diskimage_builder/elements/centos/environment.d/00-bootloader.bash deleted file mode 100644 index d406155d..00000000 --- a/diskimage_builder/elements/centos/environment.d/00-bootloader.bash +++ /dev/null @@ -1 +0,0 @@ -export DIB_EXTLINUX=1 diff --git a/diskimage_builder/elements/centos/environment.d/10-centos6-distro-name.bash b/diskimage_builder/elements/centos/environment.d/10-centos6-distro-name.bash deleted file mode 100644 index 4f38ab2e..00000000 --- a/diskimage_builder/elements/centos/environment.d/10-centos6-distro-name.bash +++ /dev/null @@ -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 diff --git a/diskimage_builder/elements/centos/package-installs.yaml b/diskimage_builder/elements/centos/package-installs.yaml deleted file mode 100644 index b8a69870..00000000 --- a/diskimage_builder/elements/centos/package-installs.yaml +++ /dev/null @@ -1,4 +0,0 @@ -parted: -cloud-utils: -cloud-utils-growpart: -dracut-modules-growroot: diff --git a/diskimage_builder/elements/centos/pre-install.d/02-yum-repos b/diskimage_builder/elements/centos/pre-install.d/02-yum-repos deleted file mode 100755 index 099a3eb6..00000000 --- a/diskimage_builder/elements/centos/pre-install.d/02-yum-repos +++ /dev/null @@ -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 diff --git a/diskimage_builder/elements/centos/root.d/10-centos6-cloud-image b/diskimage_builder/elements/centos/root.d/10-centos6-cloud-image deleted file mode 100755 index 8ff36493..00000000 --- a/diskimage_builder/elements/centos/root.d/10-centos6-cloud-image +++ /dev/null @@ -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 diff --git a/diskimage_builder/elements/centos/test-elements/build-succeeds/element-deps b/diskimage_builder/elements/centos/test-elements/build-succeeds/element-deps deleted file mode 100644 index df967b96..00000000 --- a/diskimage_builder/elements/centos/test-elements/build-succeeds/element-deps +++ /dev/null @@ -1 +0,0 @@ -base diff --git a/diskimage_builder/elements/epel/pre-install.d/05-rpm-epel-release b/diskimage_builder/elements/epel/pre-install.d/05-rpm-epel-release index 0a4a37da..2509eebc 100755 --- a/diskimage_builder/elements/epel/pre-install.d/05-rpm-epel-release +++ b/diskimage_builder/elements/epel/pre-install.d/05-rpm-epel-release @@ -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 diff --git a/diskimage_builder/elements/ironic-agent/pkg-map b/diskimage_builder/elements/ironic-agent/pkg-map index 09c2c93e..5e6758de 100644 --- a/diskimage_builder/elements/ironic-agent/pkg-map +++ b/diskimage_builder/elements/ironic-agent/pkg-map @@ -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", diff --git a/diskimage_builder/elements/pip-and-virtualenv/install.d/pip-and-virtualenv-source-install/04-install-pip b/diskimage_builder/elements/pip-and-virtualenv/install.d/pip-and-virtualenv-source-install/04-install-pip index 705c3e1c..ac63bc3a 100755 --- a/diskimage_builder/elements/pip-and-virtualenv/install.d/pip-and-virtualenv-source-install/04-install-pip +++ b/diskimage_builder/elements/pip-and-virtualenv/install.d/pip-and-virtualenv-source-install/04-install-pip @@ -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" diff --git a/diskimage_builder/elements/rhel/README.rst b/diskimage_builder/elements/rhel/README.rst deleted file mode 100644 index 0ecf6e51..00000000 --- a/diskimage_builder/elements/rhel/README.rst +++ /dev/null @@ -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. diff --git a/diskimage_builder/elements/rhel/bin/map-packages b/diskimage_builder/elements/rhel/bin/map-packages deleted file mode 100755 index c14207e1..00000000 --- a/diskimage_builder/elements/rhel/bin/map-packages +++ /dev/null @@ -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) diff --git a/diskimage_builder/elements/rhel/element-deps b/diskimage_builder/elements/rhel/element-deps deleted file mode 100644 index d8ee15ce..00000000 --- a/diskimage_builder/elements/rhel/element-deps +++ /dev/null @@ -1,4 +0,0 @@ -cache-url -rhel-common -rpm-distro -yum diff --git a/diskimage_builder/elements/rhel/element-provides b/diskimage_builder/elements/rhel/element-provides deleted file mode 100644 index a72e0496..00000000 --- a/diskimage_builder/elements/rhel/element-provides +++ /dev/null @@ -1 +0,0 @@ -operating-system diff --git a/diskimage_builder/elements/rhel/environment.d/10-rhel-distro-name.bash b/diskimage_builder/elements/rhel/environment.d/10-rhel-distro-name.bash deleted file mode 100644 index cf277400..00000000 --- a/diskimage_builder/elements/rhel/environment.d/10-rhel-distro-name.bash +++ /dev/null @@ -1 +0,0 @@ -export DISTRO_NAME=rhel diff --git a/diskimage_builder/elements/rhel/finalise.d/60-rhsm-unregister b/diskimage_builder/elements/rhel/finalise.d/60-rhsm-unregister deleted file mode 100755 index 1efdae87..00000000 --- a/diskimage_builder/elements/rhel/finalise.d/60-rhsm-unregister +++ /dev/null @@ -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 diff --git a/diskimage_builder/elements/rhel/root.d/10-rhel-cloud-image b/diskimage_builder/elements/rhel/root.d/10-rhel-cloud-image deleted file mode 100755 index 909949da..00000000 --- a/diskimage_builder/elements/rhel/root.d/10-rhel-cloud-image +++ /dev/null @@ -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 diff --git a/releasenotes/notes/centos-retired-f17ae9f6f03e57e3.yaml b/releasenotes/notes/centos-retired-f17ae9f6f03e57e3.yaml new file mode 100644 index 00000000..121534c1 --- /dev/null +++ b/releasenotes/notes/centos-retired-f17ae9f6f03e57e3.yaml @@ -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.