Browse code

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

Ian Wienand authored on 2014/10/22 09:35:29
Showing 1 changed files
... ...
@@ -234,36 +234,41 @@ fi
234 234
 
235 235
 if [[ is_fedora && ( $DISTRO == "rhel6" || $DISTRO == "rhel7" ) ]]; then
236 236
     # RHEL requires EPEL for many Open Stack dependencies
237
-    if ! sudo yum repolist enabled epel | grep -q 'epel'; then
238
-        echo "EPEL not detected; installing"
239
-        # This trick installs the latest epel-release from a bootstrap
240
-        # repo, then removes itself (as epel-release installed the
241
-        # "real" repo).
242
-        #
243
-        # you would think that rather than this, you could use
244
-        # $releasever directly in .repo file we create below.  However
245
-        # RHEL gives a $releasever of "6Server" which breaks the path;
246
-        # see https://bugzilla.redhat.com/show_bug.cgi?id=1150759
247
-        if [[ $DISTRO == "rhel7" ]]; then
248
-            epel_ver="7"
249
-        elif [[ $DISTRO == "rhel6" ]]; then
250
-            epel_ver="6"
251
-        fi
252 237
 
253
-        cat <<EOF | sudo tee /etc/yum.repos.d/epel-bootstrap.repo
254
-[epel]
238
+    # note we always remove and install latest -- some environments
239
+    # use snapshot images, and if EPEL version updates they break
240
+    # unless we update them to latest version.
241
+    if sudo yum repolist enabled epel | grep -q 'epel'; then
242
+        uninstall_package epel-release || true
243
+    fi
244
+
245
+    # This trick installs the latest epel-release from a bootstrap
246
+    # repo, then removes itself (as epel-release installed the
247
+    # "real" repo).
248
+    #
249
+    # you would think that rather than this, you could use
250
+    # $releasever directly in .repo file we create below.  However
251
+    # RHEL gives a $releasever of "6Server" which breaks the path;
252
+    # see https://bugzilla.redhat.com/show_bug.cgi?id=1150759
253
+    if [[ $DISTRO == "rhel7" ]]; then
254
+        epel_ver="7"
255
+    elif [[ $DISTRO == "rhel6" ]]; then
256
+        epel_ver="6"
257
+    fi
258
+
259
+    cat <<EOF | sudo tee /etc/yum.repos.d/epel-bootstrap.repo
260
+[epel-bootstrap]
255 261
 name=Bootstrap EPEL
256 262
 mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-$epel_ver&arch=\$basearch
257 263
 failovermethod=priority
258 264
 enabled=0
259 265
 gpgcheck=0
260 266
 EOF
261
-        # bare yum call due to --enablerepo
262
-        sudo yum --enablerepo=epel -y install epel-release || \
263
-            die $LINENO "Error installing EPEL repo, cannot continue"
264
-        # epel rpm has installed it's version
265
-        sudo rm -f /etc/yum.repos.d/epel-bootstrap.repo
266
-    fi
267
+    # bare yum call due to --enablerepo
268
+    sudo yum --enablerepo=epel-bootstrap -y install epel-release || \
269
+        die $LINENO "Error installing EPEL repo, cannot continue"
270
+    # epel rpm has installed it's version
271
+    sudo rm -f /etc/yum.repos.d/epel-bootstrap.repo
267 272
 
268 273
     # ... and also optional to be enabled
269 274
     is_package_installed yum-utils || install_package yum-utils