From 522113bc6cd6d5e529cad0e7f1e6f17fae5106da Mon Sep 17 00:00:00 2001 From: Steve Baker Date: Thu, 11 Mar 2021 11:01:29 +1300 Subject: [PATCH] Only add rhel base repos when REG_REPOS is not set For offline (satellite based) installs the base repos won't be available and the base packages will come from a different named repo in satellite which will be specified by REG_REPOS. This change will ensure no base repos are added when REG_REPOS are specified so offline image builds are possible. All required base repos need to be added to REG_REPOS when it is used. Documentation[1] already includes base repos, so this should not be disruptive. [1] https://access.redhat.com/documentation/en-us/red_hat_openstack_platform/16.1/html/director_installation_and_usage/creating-whole-disk-images#disk-image-environment-variables Change-Id: Iafb81d50dffdac40d3b011670200b8da4c3a58f0 --- diskimage_builder/elements/rhel-common/README.rst | 2 ++ .../rhel-common/pre-install.d/00-rhel-registration | 12 +++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/diskimage_builder/elements/rhel-common/README.rst b/diskimage_builder/elements/rhel-common/README.rst index 7c6401093..db8ab149c 100644 --- a/diskimage_builder/elements/rhel-common/README.rst +++ b/diskimage_builder/elements/rhel-common/README.rst @@ -104,6 +104,8 @@ A single string representing a list of repository names separated by a comma (No spaces). Each of the repositories in this string are enabled through subscription manager. Once you've attached a subscription, you can find available repositories by running subscription-manager repos --list. +No base repos will be added when REG_REPOS is set, so these must be included +in REG_REPOS. #### REG\_SERVER\_URL Gives the hostname of the subscription service to use. The default is diff --git a/diskimage_builder/elements/rhel-common/pre-install.d/00-rhel-registration b/diskimage_builder/elements/rhel-common/pre-install.d/00-rhel-registration index 7935c72d0..91e6d38da 100755 --- a/diskimage_builder/elements/rhel-common/pre-install.d/00-rhel-registration +++ b/diskimage_builder/elements/rhel-common/pre-install.d/00-rhel-registration @@ -10,15 +10,17 @@ set -o pipefail opts= attach_opts= arch=$(uname -m) +repos="repos " +base_repos= if [ "${DIB_RELEASE:-7}" == "7" ]; then - repos="repos --enable rhel-7-server-rpms" + base_repos="rhel-7-server-rpms" satellite_repo="rhel-7-server-rh-common-rpms" elif [ "${DIB_RELEASE}" == "8" ]; then if [ -n "${REG_RELEASE:-}" ]; then - repos="repos --enable rhel-8-for-${arch}-appstream-eus-rpms --enable rhel-8-for-${arch}-baseos-eus-rpms" + base_repos="rhel-8-for-${arch}-appstream-eus-rpms rhel-8-for-${arch}-baseos-eus-rpms" else - repos="repos --enable rhel-8-for-${arch}-appstream-rpms --enable rhel-8-for-${arch}-baseos-rpms" + base_repos="rhel-8-for-${arch}-appstream-rpms rhel-8-for-${arch}-baseos-rpms" fi satellite_repo="satellite-tools-6.5-for-rhel-8-${arch}-rpms" fi @@ -93,6 +95,10 @@ if [ -n "${REG_REPOS:-}" ]; then for repo in $(echo $REG_REPOS | tr ',' '\n'); do repos="$repos --enable $repo" done +else + for repo in $base_repos; do + repos="$repos --enable $repo" + done fi if [ -n "${REG_TYPE:-}" ]; then