diff --git a/elements/redhat-common/pre-install.d/02-lsb b/elements/redhat-common/pre-install.d/02-lsb index 91c78d0d2..7b3096c69 100755 --- a/elements/redhat-common/pre-install.d/02-lsb +++ b/elements/redhat-common/pre-install.d/02-lsb @@ -3,4 +3,8 @@ set -eu set -o pipefail -install -m 0755 -o root -g root /opt/stack/lsb-release/lsb_release /usr/local/bin +if [ -z "${NO_SOURCE_REPOSITORIES:-}" ]; then + install -m 0755 -o root -g root /opt/stack/lsb-release/lsb_release /usr/local/bin +else + install-packages redhat-lsb-core +fi diff --git a/elements/source-repositories/README.md b/elements/source-repositories/README.md index edd8ea5f7..196773163 100644 --- a/elements/source-repositories/README.md +++ b/elements/source-repositories/README.md @@ -103,3 +103,7 @@ The base url for all git repositories can be set by use of: So setting DIB\_GITREPOBASE=https://github.com/ when the repo location is set to http://git.openstack.org/openstack/nova.git will result in use of the https://github.com/openstack/nova.git repository. + +When doing image builds in environments where external resources are not allowed, +it is possible to disable fetching of all source repositories by including an +element in the image that sets NO_SOURCE_REPOSITORIES=1 in an environment.d script. diff --git a/elements/source-repositories/extra-data.d/98-source-repositories b/elements/source-repositories/extra-data.d/98-source-repositories index c542cb0e0..0a0e9336f 100755 --- a/elements/source-repositories/extra-data.d/98-source-repositories +++ b/elements/source-repositories/extra-data.d/98-source-repositories @@ -3,6 +3,11 @@ set -eu set -o pipefail +# Don't provide any source repositories in environments where they are not allowed +if [ -n "${NO_SOURCE_REPOSITORIES:-}" ]; then + exit 0 +fi + # If the old cache exists, move it to the new name function make_new_cache(){ local OLD_CACHE_BASE=$1