...
|
...
|
@@ -1322,13 +1322,14 @@ function yum_install {
|
1322
|
1322
|
|
1323
|
1323
|
time_start "yum_install"
|
1324
|
1324
|
|
1325
|
|
- # Warning: this would not work if yum output message
|
1326
|
|
- # have been translated to another language
|
|
1325
|
+ # - We run with LC_ALL=C so string matching *should* be OK
|
|
1326
|
+ # - Exit 1 if the failure might get better with a retry.
|
|
1327
|
+ # - Exit 2 if it is fatal.
|
1327
|
1328
|
parse_yum_result=' \
|
1328
|
1329
|
BEGIN { result=0 } \
|
1329
|
1330
|
/^YUM_FAILED/ { exit $2 } \
|
1330
|
|
- /^No package/ { result=1 } \
|
1331
|
|
- /^Failed:/ { result=1 } \
|
|
1331
|
+ /^No package/ { result=2 } \
|
|
1332
|
+ /^Failed:/ { result=2 } \
|
1332
|
1333
|
//{ print } \
|
1333
|
1334
|
END { exit result }'
|
1334
|
1335
|
|
...
|
...
|
@@ -1336,15 +1337,21 @@ function yum_install {
|
1336
|
1336
|
# missing or failed packages are OK.
|
1337
|
1337
|
# See https://bugzilla.redhat.com/show_bug.cgi?id=965567
|
1338
|
1338
|
(sudo_with_proxies "${YUM:-yum}" install -y "$@" 2>&1 || echo YUM_FAILED $?) \
|
1339
|
|
- | awk "$parse_yum_result"
|
1340
|
|
- result=$?
|
1341
|
|
-
|
1342
|
|
- if [ "$result" != 0 ]; then
|
1343
|
|
- echo $LINENO "${YUM:-yum}" install failure: $result
|
1344
|
|
- fi
|
|
1339
|
+ | awk "$parse_yum_result" && result=$? || result=$?
|
1345
|
1340
|
|
1346
|
1341
|
time_stop "yum_install"
|
1347
|
1342
|
|
|
1343
|
+ # if we return 1, then the wrapper functions will run an update
|
|
1344
|
+ # and try installing the package again as a defense against bad
|
|
1345
|
+ # mirrors. This can hide failures, especially when we have
|
|
1346
|
+ # packages that are in the "Failed:" section because their rpm
|
|
1347
|
+ # install scripts failed to run correctly (in this case, the
|
|
1348
|
+ # package looks installed, so when the retry happens we just think
|
|
1349
|
+ # the package is OK, and incorrectly continue on).
|
|
1350
|
+ if [ "$result" == 2 ]; then
|
|
1351
|
+ die "Detected fatal package install failure"
|
|
1352
|
+ fi
|
|
1353
|
+
|
1348
|
1354
|
return "$result"
|
1349
|
1355
|
}
|
1350
|
1356
|
|