Files
55232a87c1dc338b937f51a63458e79918d65679
puppet-openstack-integration /configure_facts.sh

103 lines
4.5 KiB
Bash
Raw Normal View History

# Copyright 2017 Red Hat, Inc.
#
# 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.
export WRITE_FACTS=${WRITE_FACTS:-true}
export DLRN_DEPS_BASE=${DLRN_DEPS_BASE:-${OS_NAME_VERS}-master/deps/latest/}
export DLRN_BASE_URL=${DLRN_BASE_URL:-${OS_NAME_VERS}-master/puppet-passed-ci/delorean.repo}
export DLRN_DEPS_URL=${DLRN_DEPS_URL:-${OS_NAME_VERS}-master/delorean-deps.repo}
export SCRIPT_DIR=$(cd `dirname 0ドル` && pwd -P)
source $SCRIPT_DIR/functions
if [ -f /etc/ci/mirror_info.sh ]; then
source /etc/ci/mirror_info.sh
if [ "${OS_NAME_VERS}" == "centos9" ]; then
CENTOS_MIRROR_HOST="http://${NODEPOOL_MIRROR_HOST}/centos-stream"
else
CENTOS_MIRROR_HOST="http://${NODEPOOL_MIRROR_HOST}"
fi
NODEPOOL_PUPPETLABS_MIRROR="http://${NODEPOOL_MIRROR_HOST}/apt-puppetlabs"
CEPH_MIRROR_HOST="${CENTOS_MIRROR_HOST}/centos/${VERSION_ID}-stream/storage/x86_64/ceph-${CEPH_VERSION}/"
NODEPOOL_PUPPETLABS_MIRROR="http://${NODEPOOL_MIRROR_HOST}/yum-puppetlabs"
else
CENTOS_MIRROR_HOST='http://mirror.stream.centos.org'
else
CENTOS_MIRROR_HOST='http://mirror.centos.org'
fi
NODEPOOL_UCA_MIRROR='http://ubuntu-cloud.archive.canonical.com/ubuntu'
if uses_debs; then
NODEPOOL_PUPPETLABS_MIRROR='https://apt.puppetlabs.com'
CEPH_MIRROR_HOST="${CENTOS_MIRROR_HOST}/SIGs/${VERSION_ID}-stream/storage/x86_64/ceph-${CEPH_VERSION}/"
else
CEPH_MIRROR_HOST="${CENTOS_MIRROR_HOST}/centos/${VERSION_ID}-stream/storage/x86_64/ceph-${CEPH_VERSION}/"
fi
fi
sed -i -e "s|https://trunk.rdoproject.org|${NODEPOOL_RDO_PROXY}|g" /tmp/delorean.repo
sed -i -e "s|https://trunk.rdoproject.org|${NODEPOOL_RDO_PROXY}|g" /tmp/delorean-deps.repo
export FACTER_uca_mirror_host=$NODEPOOL_UCA_MIRROR
export FACTER_delorean_repo_path="/tmp/delorean.repo"
export FACTER_delorean_deps_repo_path="/tmp/delorean-deps.repo"
MIRROR_FACTS="\
uca_mirror_host=${FACTER_uca_mirror_host}
ceph_version=${FACTER_ceph_version}
delorean_repo_path=${FACTER_delorean_repo_path}
delorean_deps_repo_path=${FACTER_delorean_deps_repo_path}"
if [ "${WRITE_FACTS}" = true ]; then
$SUDO mkdir -p /etc/facter/facts.d/
echo "$MIRROR_FACTS" | $SUDO tee /etc/facter/facts.d/mirrors.txt
fi