summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam A. Kennington III <wak@google.com>2025-09-02 23:45:51 +0300
committerWilliam A. Kennington III <wak@google.com>2025-09-03 20:22:21 +0300
commit40da3c01be75072efa3dcf67b9bdc44186a86e27 (patch)
tree3492cc131f4a2934fc1f437c1f5cb7dc79b83399
parent2c2a74808bb636119c8a5badc973ff8a6c6f5f53 (diff)
downloadopenbmc-40da3c01be75072efa3dcf67b9bdc44186a86e27.tar.xz
meta-google: gbmc-update: Check HTTP codes
We have cases where the error code can be set, and we just parse the result file anyway as curl doesn't promote http_codes that aren't 200 to errors. Change-Id: Ie21b731c0fdf2d9fe1ed0d70bcee8e5580aa1323 Signed-off-by: William A. Kennington III <wak@google.com>
-rw-r--r--meta-google/recipes-phosphor/flash/gbmc-update/40-gbmc-upgrade.sh18
1 files changed, 10 insertions, 8 deletions
diff --git a/meta-google/recipes-phosphor/flash/gbmc-update/40-gbmc-upgrade.sh b/meta-google/recipes-phosphor/flash/gbmc-update/40-gbmc-upgrade.sh
index c66970066a..43b7a512eb 100644
--- a/meta-google/recipes-phosphor/flash/gbmc-update/40-gbmc-upgrade.sh
+++ b/meta-google/recipes-phosphor/flash/gbmc-update/40-gbmc-upgrade.sh
@@ -104,17 +104,20 @@ gbmc_upgrade_download() {
# Tar failures when curl succeeds are hard errors to start over.
# shellcheck disable=SC2143
if (( st[1] != 0 )) && [[ -n $(grep -v '\(Exiting with failure status\|Not found in archive\|Cannot hard link\)' "$tmpdir"/tarerr) ]]; then
- update_netboot_status "fetch_tar" "couldn't get TAR file, netboot fail" "FAIL"
+ update_netboot_status "$state" "couldn't get TAR file, netboot fail" "FAIL" "$retry"
return 1
fi
- # Success should continue without retry
- break
+ update_netboot_status "$state" "Succesfully fetched TAR" "SUCCESS" "$retry"
+ return 0
fi
else
- if curl -LSsk --max-time "${single_deadline}" "${bootfile_url}${path}" -o "${output}"; then
- # Success should continue without retry
- update_netboot_status "$state" "Succesfully fetched" "SUCCESS" "$retry"
- break
+ local http_code
+ if http_code="$(curl -LSsk --max-time "${single_deadline}" "${bootfile_url}${path}" -o "${output}" -w "%{http_code}")"; then
+ if (( http_code == 200 )); then
+ update_netboot_status "$state" "Succesfully fetched" "SUCCESS" "$retry"
+ return 0
+ fi
+ update_netboot_status "$state" "Got HTTP error code $http_code" "ONGOING" "$retry"
fi
fi
if (( SECONDS + stime >= timeout )); then
@@ -125,7 +128,6 @@ gbmc_upgrade_download() {
update_netboot_status "$state" "Failed to fetch $state, retrying" "RETRYING" "$retry"
(( retry = retry + 1 ))
done
- return 0
}
gbmc_upgrade_dl_metadata() {