From 9f688f53da9d2d82af7bd96cfb965aebd0b840a9 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Mon, 14 Oct 2019 14:25:26 +1100 Subject: [PATCH] centos7; use numeric DIB_RELEASE With the introduction of centos 8 we have constructs like if [[ $DISTRO =~ (centos|fedora) && $DIB_RELEASE -ge 8 ]] This is intended to match the "centos7" element (from the =~) but it was missed that this is setting the DIB_RELEASE to "GenericCloud". I think it makes more sense for this to be a numeric release, and makes constructs like above work. There really isn't any other type of image to choose here; thus we move it into a new, centos7 specific variable. Note that when the centos 8 images are available, we want to move to a generic "centos" element that will handle both 7 and 8 together (same as rhel) based on DIB_RELEASE and deprecate centos7; this works with that environment too. Change-Id: I2e6b7848070d6452c0563e2a122447627c6e6bf7 --- .../centos7/environment.d/10-centos7-distro-name.bash | 2 +- .../elements/centos7/root.d/10-centos7-cloud-image | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/diskimage_builder/elements/centos7/environment.d/10-centos7-distro-name.bash b/diskimage_builder/elements/centos7/environment.d/10-centos7-distro-name.bash index 9291e56df..66a7fdc51 100644 --- a/diskimage_builder/elements/centos7/environment.d/10-centos7-distro-name.bash +++ b/diskimage_builder/elements/centos7/environment.d/10-centos7-distro-name.bash @@ -1,5 +1,5 @@ export DISTRO_NAME=centos7 -export DIB_RELEASE=GenericCloud +export DIB_RELEASE=7 # Useful for elements that work with fedora (dnf) & centos export YUM=${YUM:-yum} diff --git a/diskimage_builder/elements/centos7/root.d/10-centos7-cloud-image b/diskimage_builder/elements/centos7/root.d/10-centos7-cloud-image index 8d5d6e6b0..8b46afa4a 100755 --- a/diskimage_builder/elements/centos7/root.d/10-centos7-cloud-image +++ b/diskimage_builder/elements/centos7/root.d/10-centos7-cloud-image @@ -32,8 +32,8 @@ if [ -n "$DIB_LOCAL_IMAGE" ]; then BASE_IMAGE_FILE=$(basename $DIB_LOCAL_IMAGE) BASE_IMAGE_TAR=$BASE_IMAGE_FILE.tgz else - DIB_RELEASE=${DIB_RELEASE:-GenericCloud} - BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-CentOS-7-${ARCH}-$DIB_RELEASE.qcow2.xz} + DIB_CENTOS7_CLOUD_RELEASE=${DIB_CENTOS7_CLOUD_RELEASE:-GenericCloud} + BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-CentOS-7-${ARCH}-$DIB_CENTOS7_CLOUD_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