From 7774260b7691fa218f0a9a1b575aa46aae77c796 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Fri, 25 Aug 2017 15:47:29 +1000 Subject: [PATCH] Use latest Fedora .qcow URL The URL we are using seems to have disappeared. Update this to download.fedoraproject.org. The new URL requires a "subrelease" now, add it, along with a note on where it comes from. Change-Id: I761e425f8a658669d9b8a70ce4260cec263ea51a --- .../environment.d/10-fedora-distro-name.bash | 19 +++++++++++++++++++ .../fedora/root.d/10-fedora-cloud-image | 8 ++++---- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/diskimage_builder/elements/fedora/environment.d/10-fedora-distro-name.bash b/diskimage_builder/elements/fedora/environment.d/10-fedora-distro-name.bash index b044581a..b9a87ac1 100644 --- a/diskimage_builder/elements/fedora/environment.d/10-fedora-distro-name.bash +++ b/diskimage_builder/elements/fedora/environment.d/10-fedora-distro-name.bash @@ -1,2 +1,21 @@ export DISTRO_NAME=fedora export DIB_RELEASE=${DIB_RELEASE:-26} + +# Note the filename URL has a "sub-release" in it +# http:// ... Fedora-Cloud-Base-25-1.3.x86_64.qcow2 +# ^^^ +# It's not exactly clear how this is generated, or how we could +# determine this programatically. Other projects have more +# complicated regex-based scripts to find this, which we can examine +# if this becomes an issue ... see thread at [1] +# +# [1] https://lists.fedoraproject.org/archives/list/cloud@lists.fedoraproject.org/thread/2WFO2FKIGUQYRQXIR35UVJGRHF7LQENJ/ + +if [[ ${DIB_RELEASE} == '25' ]]; then + export DIB_FEDORA_SUBRELEASE=1.3 +elif [[ ${DIB_RELEASE} == '26' ]]; then + export DIB_FEDORA_SUBRELEASE=1.5 +else + echo "Unsupported Fedora release" + exit 1 +fi diff --git a/diskimage_builder/elements/fedora/root.d/10-fedora-cloud-image b/diskimage_builder/elements/fedora/root.d/10-fedora-cloud-image index c89e29be..7d1d9d21 100755 --- a/diskimage_builder/elements/fedora/root.d/10-fedora-cloud-image +++ b/diskimage_builder/elements/fedora/root.d/10-fedora-cloud-image @@ -24,12 +24,12 @@ if [ -n "$DIB_LOCAL_IMAGE" ]; then BASE_IMAGE_TAR=$BASE_IMAGE_FILE.tgz else # note default DIB_RELEASE set in environment setup - DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-http://cloud.fedoraproject.org} - BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-fedora-$DIB_RELEASE.$ARCH.qcow2} - BASE_IMAGE_TAR=$DIB_RELEASE-Cloud-$ARCH-$DIB_RELEASE.tgz + # Not sure if ${ARCH} is defined for anything but x86_64 here + DIB_CLOUD_IMAGES=${DIB_CLOUD_IMAGES:-https://download.fedoraproject.org/pub/fedora/linux/releases/${DIB_RELEASE}/CloudImages/${ARCH}/images} + BASE_IMAGE_FILE=${BASE_IMAGE_FILE:-Fedora-Cloud-Base-$DIB_RELEASE-$DIB_FEDORA_SUBRELEASE.$ARCH.qcow2} + BASE_IMAGE_TAR=Fedora-Cloud-Base-$DIB_RELEASE-$DIB_FEDORA_SUBRELEASE.$ARCH.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