@@ -329,9 +329,6 @@ function _ensure_lsb_release {
329329 sudo zypper -n install lsb-release
330330 elif [[ -x $( command -v dnf 2> /dev/null) ]]; then
331331 sudo dnf install -y redhat-lsb-core
332- elif [[ -x $( command -v yum 2> /dev/null) ]]; then
333- # all rh patforms (fedora, centos, rhel) have this pkg
334- sudo yum install -y redhat-lsb-core
335332 else
336333 die $LINENO " Unable to find or auto-install lsb_release"
337334 fi
@@ -1361,61 +1358,28 @@ function uninstall_package {
13611358 if is_ubuntu; then
13621359 apt_get purge " $@ "
13631360 elif is_fedora; then
1364- sudo ${YUM :- yum} remove -y " $@ " || :
1361+ sudo dnf remove -y " $@ " || :
13651362 elif is_suse; then
13661363 sudo zypper remove -y " $@ " || :
13671364 else
13681365 exit_distro_not_supported " uninstalling packages"
13691366 fi
13701367}
13711368
1372- # Wrapper for ``yum`` to set proxy environment variables
1373- # Uses globals ``OFFLINE``, ``*_proxy``, ``YUM``
1369+ # Wrapper for ``dnf`` to set proxy environment variables
1370+ # Uses globals ``OFFLINE``, ``*_proxy``
1371+ # The name is kept for backwards compatability with external
1372+ # callers, despite none of our supported platforms using yum
1373+ # any more.
13741374# yum_install package [package ...]
13751375function yum_install {
13761376 local result parse_yum_result
13771377
13781378 [[ " $OFFLINE " = " True" ]] && return
13791379
13801380 time_start " yum_install"
1381-
1382- # This is a bit tricky, because yum -y assumes missing or failed
1383- # packages are OK (see [1]). We want devstack to stop if we are
1384- # installing missing packages.
1385- #
1386- # Thus we manually match on the output (stack.sh runs in a fixed
1387- # locale, so lang shouldn't change).
1388- #
1389- # If yum returns !0, we echo the result as "YUM_FAILED" and return
1390- # that from the awk (we're subverting -e with this trick).
1391- # Otherwise we use awk to look for failure strings and return "2"
1392- # to indicate a terminal failure.
1393- #
1394- # [1] https://bugzilla.redhat.com/show_bug.cgi?id=965567
1395- parse_yum_result=' \
1396- BEGIN { result=0 } \
1397- /^YUM_FAILED/ { result=$2 } \
1398- /^No package/ { result=2 } \
1399- /^Failed:/ { result=2 } \
1400- //{ print } \
1401- END { exit result }'
1402- (sudo_with_proxies " ${YUM:- yum} " install -y " $@ " 2>&1 || echo YUM_FAILED $? ) \
1403- | awk " $parse_yum_result " && result=$? || result=$?
1404-
1381+ sudo_with_proxies dnf install -y " $@ "
14051382 time_stop " yum_install"
1406-
1407- # if we return 1, then the wrapper functions will run an update
1408- # and try installing the package again as a defense against bad
1409- # mirrors. This can hide failures, especially when we have
1410- # packages that are in the "Failed:" section because their rpm
1411- # install scripts failed to run correctly (in this case, the
1412- # package looks installed, so when the retry happens we just think
1413- # the package is OK, and incorrectly continue on).
1414- if [ " $result " == 2 ]; then
1415- die " Detected fatal package install failure"
1416- fi
1417-
1418- return " $result "
14191383}
14201384
14211385# zypper wrapper to set arguments correctly
0 commit comments