| ... | ... |
@@ -1334,20 +1334,26 @@ function yum_install {
|
| 1334 | 1334 |
|
| 1335 | 1335 |
time_start "yum_install" |
| 1336 | 1336 |
|
| 1337 |
- # - We run with LC_ALL=C so string matching *should* be OK |
|
| 1338 |
- # - Exit 1 if the failure might get better with a retry. |
|
| 1339 |
- # - Exit 2 if it is fatal. |
|
| 1340 |
- parse_yum_result=' \ |
|
| 1341 |
- BEGIN { result=0 } \
|
|
| 1342 |
- /^YUM_FAILED/ { exit $2 } \
|
|
| 1343 |
- /^No package/ { result=2 } \
|
|
| 1344 |
- /^Failed:/ { result=2 } \
|
|
| 1345 |
- //{ print } \
|
|
| 1337 |
+ # This is a bit tricky, because yum -y assumes missing or failed |
|
| 1338 |
+ # packages are OK (see [1]). We want devstack to stop if we are |
|
| 1339 |
+ # installing missing packages. |
|
| 1340 |
+ # |
|
| 1341 |
+ # Thus we manually match on the output (stack.sh runs in a fixed |
|
| 1342 |
+ # locale, so lang shouldn't change). |
|
| 1343 |
+ # |
|
| 1344 |
+ # If yum returns !0, we echo the result as "YUM_FAILED" and return |
|
| 1345 |
+ # that from the awk (we're subverting -e with this trick). |
|
| 1346 |
+ # Otherwise we use awk to look for failure strings and return "2" |
|
| 1347 |
+ # to indicate a terminal failure. |
|
| 1348 |
+ # |
|
| 1349 |
+ # [1] https://bugzilla.redhat.com/show_bug.cgi?id=965567 |
|
| 1350 |
+ parse_yum_result=' \ |
|
| 1351 |
+ BEGIN { result=0 } \
|
|
| 1352 |
+ /^YUM_FAILED/ { result=$2 } \
|
|
| 1353 |
+ /^No package/ { result=2 } \
|
|
| 1354 |
+ /^Failed:/ { result=2 } \
|
|
| 1355 |
+ //{ print } \
|
|
| 1346 | 1356 |
END { exit result }'
|
| 1347 |
- |
|
| 1348 |
- # The manual check for missing packages is because yum -y assumes |
|
| 1349 |
- # missing or failed packages are OK. |
|
| 1350 |
- # See https://bugzilla.redhat.com/show_bug.cgi?id=965567 |
|
| 1351 | 1357 |
(sudo_with_proxies "${YUM:-yum}" install -y "$@" 2>&1 || echo YUM_FAILED $?) \
|
| 1352 | 1358 |
| awk "$parse_yum_result" && result=$? || result=$? |
| 1353 | 1359 |
|