Always install latest EPEL

Having issues with the centos7 job, that seem to be because they use
an old snapshot that hasn't updated to the latest EPEL.  Thus we
re-install it to ensure we're getting the latest.

Change-Id: I7930f3e05ee953dab80b06142c17d6aa70f2c2d1
This commit is contained in:
Ian Wienand 2014-10-22 11:35:29 +11:00
parent 572a4c4c3c
commit ed077b2846

View File

@ -234,36 +234,41 @@ fi
if [[ is_fedora && ( $DISTRO == "rhel6" || $DISTRO == "rhel7" ) ]]; then
# RHEL requires EPEL for many Open Stack dependencies
if ! sudo yum repolist enabled epel | grep -q 'epel'; then
echo "EPEL not detected; installing"
# This trick installs the latest epel-release from a bootstrap
# repo, then removes itself (as epel-release installed the
# "real" repo).
#
# you would think that rather than this, you could use
# $releasever directly in .repo file we create below. However
# RHEL gives a $releasever of "6Server" which breaks the path;
# see https://bugzilla.redhat.com/show_bug.cgi?id=1150759
if [[ $DISTRO == "rhel7" ]]; then
epel_ver="7"
elif [[ $DISTRO == "rhel6" ]]; then
epel_ver="6"
fi
cat <<EOF | sudo tee /etc/yum.repos.d/epel-bootstrap.repo
[epel]
# note we always remove and install latest -- some environments
# use snapshot images, and if EPEL version updates they break
# unless we update them to latest version.
if sudo yum repolist enabled epel | grep -q 'epel'; then
uninstall_package epel-release || true
fi
# This trick installs the latest epel-release from a bootstrap
# repo, then removes itself (as epel-release installed the
# "real" repo).
#
# you would think that rather than this, you could use
# $releasever directly in .repo file we create below. However
# RHEL gives a $releasever of "6Server" which breaks the path;
# see https://bugzilla.redhat.com/show_bug.cgi?id=1150759
if [[ $DISTRO == "rhel7" ]]; then
epel_ver="7"
elif [[ $DISTRO == "rhel6" ]]; then
epel_ver="6"
fi
cat <<EOF | sudo tee /etc/yum.repos.d/epel-bootstrap.repo
[epel-bootstrap]
name=Bootstrap EPEL
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-$epel_ver&arch=\$basearch
failovermethod=priority
enabled=0
gpgcheck=0
EOF
# bare yum call due to --enablerepo
sudo yum --enablerepo=epel -y install epel-release || \
die $LINENO "Error installing EPEL repo, cannot continue"
# epel rpm has installed it's version
sudo rm -f /etc/yum.repos.d/epel-bootstrap.repo
fi
# bare yum call due to --enablerepo
sudo yum --enablerepo=epel-bootstrap -y install epel-release || \
die $LINENO "Error installing EPEL repo, cannot continue"
# epel rpm has installed it's version
sudo rm -f /etc/yum.repos.d/epel-bootstrap.repo
# ... and also optional to be enabled
is_package_installed yum-utils || install_package yum-utils