From 175fd077ef49622ce6d88f562214495a94493878 Mon Sep 17 00:00:00 2001 From: Alex Schultz Date: Thu, 24 Aug 2017 15:49:16 -0600 Subject: [PATCH] Split out mirror facts This change splits out the facts from the run_tests.sh so it can be leveraged elsewhere (like beaker) to write out the mirror information to as static facter facts. Refactor to fix hitting rdpoproject.org directly. Added missing UCA nodepool variable. Change-Id: Iae985e8b976850d8386390cfbadb75e434463479 Signed-off-by: Paul Belanger --- configure_facts.sh | 66 ++++++++++++++++++++++++++++++++++++++++++++++ run_tests.sh | 31 ++++------------------ 2 files changed, 71 insertions(+), 26 deletions(-) create mode 100644 configure_facts.sh diff --git a/configure_facts.sh b/configure_facts.sh new file mode 100644 index 000000000..606797657 --- /dev/null +++ b/configure_facts.sh @@ -0,0 +1,66 @@ +#!/bin/bash -ex +# 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. + +# Write out facts to the facter folder when we generate them. +export WRITE_FACTS=${WRITE_FACTS:-true} + +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 + CENTOS_MIRROR_HOST="http://${NODEPOOL_MIRROR_HOST}" + BUILDLOGS_MIRROR_HOST="${NODEPOOL_BUILDLOGS_CENTOS_PROXY}/centos/7/cloud/x86_64/openstack-pike" + if uses_debs; then + CEPH_MIRROR_HOST="${CENTOS_MIRROR_HOST}/ceph-deb-jewel" + else + CEPH_MIRROR_HOST="${CENTOS_MIRROR_HOST}/centos/7/storage/x86_64/ceph-jewel/" + fi +else + CENTOS_MIRROR_HOST='http://mirror.centos.org' + BUILDLOGS_MIRROR_HOST='https://buildlogs.centos.org/centos/7/cloud/x86_64/openstack-pike' + NODEPOOL_RDO_PROXY='https://trunk.rdoproject.org' + NODEPOOL_UCA_MIRROR='http://ubuntu-cloud.archive.canonical.com/ubuntu' + if uses_debs; then + CEPH_MIRROR_HOST='https://download.ceph.com/debian-jewel' + else + CEPH_MIRROR_HOST='http://mirror.centos.org/centos/7/storage/x86_64/ceph-jewel/' + fi +fi + +rdo_dlrn=`curl --silent ${NODEPOOL_RDO_PROXY}/centos7-master/puppet-passed-ci/delorean.repo | grep baseurl | cut -d= -f2` +if [[ -z "$rdo_dlrn" ]]; then + echo "Failed to parse dlrn hash" + exit 1 +fi +RDO_MIRROR_HOST=${rdo_dlrn/https:\/\/trunk.rdoproject.org/$NODEPOOL_RDO_PROXY} + +export FACTER_centos_mirror_host=$CENTOS_MIRROR_HOST +export FACTER_uca_mirror_host=$NODEPOOL_UCA_MIRROR +export FACTER_buildlogs_mirror_host=$BUILDLOGS_MIRROR_HOST +export FACTER_ceph_mirror_host=$CEPH_MIRROR_HOST +export FACTER_rdo_mirror_host=$RDO_MIRROR_HOST + +MIRROR_FACTS="\ +centos_mirror_host=${FACTER_centos_mirror_host} +uca_mirror_host=${FACTER_uca_mirror_host} +buildlogs_mirror_host=${FACTER_buildlogs_mirror_host} +ceph_mirror_host=${FACTER_ceph_mirror_host} +rdo_mirror_host=${FACTER_rdo_mirror_host}" + +if [ "${WRITE_FACTS}" = true ]; then + $SUDO mkdir -p /etc/facter/facts.d/ + echo "$MIRROR_FACTS" | $SUDO tee /etc/facter/facts.d/mirrors.txt +fi diff --git a/run_tests.sh b/run_tests.sh index a6076ac83..385c169f8 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -37,33 +37,12 @@ export TEMPEST_FROM_SOURCE=${TEMPEST_FROM_SOURCE:-true} # Cirros Image directory export IMG_DIR=${IMG_DIR:-'/tmp/openstack/image'} -RDO_MIRROR_HOST=`curl --silent https://trunk.rdoproject.org/centos7-master/puppet-passed-ci/delorean.repo | grep baseurl | cut -d= -f2` -# NOTE(pabelanger): Setup facter to know about AFS mirror. -if [ -f /etc/ci/mirror_info.sh ]; then - source /etc/ci/mirror_info.sh - CENTOS_MIRROR_HOST="http://${NODEPOOL_MIRROR_HOST}" - BUILDLOGS_MIRROR_HOST="${NODEPOOL_BUILDLOGS_CENTOS_PROXY}/centos/7/cloud/x86_64/openstack-pike" - RDO_MIRROR_HOST=${RDO_MIRROR_HOST/https:\/\/trunk.rdoproject.org/$NODEPOOL_MIRROR_HOST:8080/rdo} - if uses_debs; then - CEPH_MIRROR_HOST="${CENTOS_MIRROR_HOST}/ceph-deb-jewel" - else - CEPH_MIRROR_HOST="${CENTOS_MIRROR_HOST}/centos/7/storage/x86_64/ceph-jewel/" - fi -else - CENTOS_MIRROR_HOST='http://mirror.centos.org' - BUILDLOGS_MIRROR_HOST='https://buildlogs.centos.org/centos/7/cloud/x86_64/openstack-pike' - if uses_debs; then - CEPH_MIRROR_HOST='https://download.ceph.com/debian-jewel' - else - CEPH_MIRROR_HOST='http://mirror.centos.org/centos/7/storage/x86_64/ceph-jewel/' - fi -fi -export FACTER_centos_mirror_host=$CENTOS_MIRROR_HOST -export FACTER_uca_mirror_host=$NODEPOOL_UCA_MIRROR -export FACTER_buildlogs_mirror_host=$BUILDLOGS_MIRROR_HOST -export FACTER_ceph_mirror_host=$CEPH_MIRROR_HOST -export FACTER_rdo_mirror_host="http://${RDO_MIRROR_HOST}" +# if we're running the tests we don't need to write out the facts to facter +# so we can disable it. +export WRITE_FACTS=false +source ${SCRIPT_DIR}/configure_facts.sh + if [ $PUPPET_MAJ_VERSION == 4 ]; then export PATH=${PATH}:/opt/puppetlabs/bin:/opt/puppetlabs/puppet/bin