Browse code

CentOS: Fix EPEL mirroring and RDO install on CI nodes

CentOS tests have reverted to using upstream for EPEL rather than
local mirrors, introducing some unnecessary instability. The root of
the problem is that /etc/nodepool/provider disappeared with zuulv3, so
we now always re-install the EPEL repo and overwrite the local EPEL
.repos files that were made during test setup and point to local
mirrors.

The other change is that we stopped installing the RDO repositories on
the testing nodes too. That we were incorrectly taking this path and
reinstalling EPEL has hidden the removal of these packages from the
base image in the test, since it ends up installing them too.

Split the install into two parts -- epel and RDO. Check for
/etc/ci/mirror_info.sh (the sourcable mirror script provided by base
test setup) and if so, just enable EPEL so we get the CI-mirror
version correctly. Install the RDO repositories (if not already
installed) unconditionally.

Change-Id: Iccb045a6695deb10da4d68a5694e1fa45ccbb810

Ian Wienand authored on 2017/12/04 09:32:36
Showing 1 changed files
... ...
@@ -282,7 +282,7 @@ fi
282 282
 # Some distros need to add repos beyond the defaults provided by the vendor
283 283
 # to pick up required packages.
284 284
 
285
-function _install_epel_and_rdo {
285
+function _install_epel {
286 286
     # NOTE: We always remove and install latest -- some environments
287 287
     # use snapshot images, and if EPEL version updates they break
288 288
     # unless we update them to latest version.
... ...
@@ -313,12 +313,27 @@ EOF
313 313
     yum_install epel-release || \
314 314
         die $LINENO "Error installing EPEL repo, cannot continue"
315 315
     sudo rm -f /etc/yum.repos.d/epel-bootstrap.repo
316
+}
316 317
 
317
-    # ... and also optional to be enabled
318
-    sudo yum-config-manager --enable rhel-7-server-optional-rpms
318
+function _install_rdo {
319
+    # There are multiple options for this, including using CloudSIG
320
+    # repositories (centos-release-*), trunk versions, etc.  Since
321
+    # we're not interested in the actual openstack distributions
322
+    # (since we're using git to run!) but only peripherial packages
323
+    # like kvm or ovs, this has been reliable.
324
+
325
+    # TODO(ianw): figure out how to best mirror -- probably use infra
326
+    # mirror RDO reverse proxy.  We could either have test
327
+    # infrastructure set it up disabled like EPEL, or fiddle it here.
328
+    # Per the point above, it's a bunch of repos so starts getting a
329
+    # little messy...
330
+    if ! is_package_installed rdo-release ; then
331
+        yum_install https://rdoproject.org/repos/rdo-release.rpm
332
+    fi
319 333
 
320
-    # install the lastest RDO
321
-    is_package_installed rdo-release || yum_install https://rdoproject.org/repos/rdo-release.rpm
334
+    # Also enable optional for RHEL7 proper.  Note this is a silent
335
+    # no-op on other platforms.
336
+    sudo yum-config-manager --enable rhel-7-server-optional-rpms
322 337
 
323 338
     if is_oraclelinux; then
324 339
         sudo yum-config-manager --enable ol7_optional_latest ol7_addons ol7_MySQL56
... ...
@@ -362,20 +377,22 @@ fi
362 362
 # to speed things up
363 363
 SKIP_EPEL_INSTALL=$(trueorfalse False SKIP_EPEL_INSTALL)
364 364
 
365
-# If we have /etc/nodepool/provider assume we're on a OpenStack CI
366
-# node, where EPEL is already pointing at our internal mirror and RDO
367
-# is pre-installed.
368
-if [[ -f /etc/nodepool/provider ]]; then
369
-    SKIP_EPEL_INSTALL=True
370
-    if is_fedora; then
371
-        # However, EPEL is not enabled by default.
365
+if [[ $DISTRO == "rhel7" ]]; then
366
+    # If we have /etc/ci/mirror_info.sh assume we're on a OpenStack CI
367
+    # node, where EPEL is installed (but disabled) and already
368
+    # pointing at our internal mirror
369
+    if [[ -f /etc/ci/mirror_info.sh ]]; then
370
+        SKIP_EPEL_INSTALL=True
372 371
         sudo yum-config-manager --enable epel
373 372
     fi
374
-fi
375 373
 
376
-if is_fedora && [[ $DISTRO == "rhel7" ]] && \
377
-        [[ ${SKIP_EPEL_INSTALL} != True ]]; then
378
-    _install_epel_and_rdo
374
+    if [[ ${SKIP_EPEL_INSTALL} != True ]]; then
375
+        _install_epel
376
+    fi
377
+    # Along with EPEL, CentOS (and a-likes) require some packages only
378
+    # available in RDO repositories (e.g. OVS, or later versions of
379
+    # kvm) to run.
380
+    _install_rdo
379 381
 fi
380 382
 
381 383
 # Ensure python is installed