From 8017026bc8784a9d76ef21f58f39c0139453ceaf Mon Sep 17 00:00:00 2001 From: Louis Abel Date: Tue, 12 Jul 2022 00:59:19 -0700 Subject: [PATCH] Add a final grep to log for "FAILED" (RLBT#0000138) Add a final grep if exit code of reposync is 0. There are cases where dnf reposync will say the sync succeeded despite not downloading a package due to a failed mirror. It is a failure when a GPG key can't be verified or some other unforeseen cirumstance... but not when a package can't be downloaded because of "all mirrors tried" Also added "time" to the fpsync commands for RL9 syncing. --- .../empanadas/templates/reposync-src.tmpl | 17 +++++++++++++++++ iso/empanadas/empanadas/templates/reposync.tmpl | 17 +++++++++++++++++ sync/sync-to-prod-9.sh | 2 +- sync/sync-to-staging-9.sh | 2 +- 4 files changed, 36 insertions(+), 2 deletions(-) diff --git a/iso/empanadas/empanadas/templates/reposync-src.tmpl b/iso/empanadas/empanadas/templates/reposync-src.tmpl index 7f901a9..3758643 100644 --- a/iso/empanadas/empanadas/templates/reposync-src.tmpl +++ b/iso/empanadas/empanadas/templates/reposync-src.tmpl @@ -5,4 +5,21 @@ set -o pipefail sed -i 's/enabled=1/enabled=0/g' /etc/yum.repos.d/*.repo {{ sync_cmd }} | tee -a {{ sync_log }} +# Yes this is a bit hacky. Can't think of a better way to do this. +ret_val=$? +if [ "$ret_val" -ne 0 ]; then + echo "SYNCING FAILED" | tee -a {{ sync_log }} + exit 1 +fi + +if [ "$ret_val" -eq 0 ]; then + recs=$(grep '\[FAILED\]' {{ sync_log }}) + if [[ -n "${recs}" ]]; then + echo "SOME PACKAGES DID NOT DOWNLOAD" | tee -a {{ sync_log }} + exit 1 + else + exit 0 + fi +fi + # {{ check_cmd }} | tee -a {{ sync_log }} diff --git a/iso/empanadas/empanadas/templates/reposync.tmpl b/iso/empanadas/empanadas/templates/reposync.tmpl index 5fb3740..d2bf35e 100644 --- a/iso/empanadas/empanadas/templates/reposync.tmpl +++ b/iso/empanadas/empanadas/templates/reposync.tmpl @@ -6,4 +6,21 @@ set -o pipefail sed -i 's/enabled=1/enabled=0/g' /etc/yum.repos.d/*.repo {{ sync_cmd }} | tee -a {{ sync_log }} +# Yes this is a bit hacky. Can't think of a better way to do this. +ret_val=$? +if [ "$ret_val" -ne 0 ]; then + echo "SYNCING FAILED" | tee -a {{ sync_log }} + exit 1 +fi + +if [ "$ret_val" -eq 0 ]; then + recs=$(grep '\[FAILED\]' {{ sync_log }}) + if [[ -n "${recs}" ]]; then + echo "SOME PACKAGES DID NOT DOWNLOAD" | tee -a {{ sync_log }} + exit 1 + else + exit 0 + fi +fi + # {{ check_cmd }} | tee -a {{ sync_log }} diff --git a/sync/sync-to-prod-9.sh b/sync/sync-to-prod-9.sh index 6eb70b8..ab45c79 100644 --- a/sync/sync-to-prod-9.sh +++ b/sync/sync-to-prod-9.sh @@ -13,7 +13,7 @@ ret_val=$? if [ $ret_val -eq "0" ]; then TARGET="${PRODUCTION_ROOT}/${CATEGORY_STUB}/${REV:0:3}" mkdir -p "${TARGET}" - sudo -l && fpsync -o '-av --numeric-ids --no-compress --chown=10004:10005' -n 18 -t /mnt/compose/partitions "${STAGING_ROOT}/${CATEGORY_STUB}/${REV}/" "${TARGET}/" + sudo -l && time fpsync -o '-av --numeric-ids --no-compress --chown=10004:10005' -n 18 -t /mnt/compose/partitions "${STAGING_ROOT}/${CATEGORY_STUB}/${REV}/" "${TARGET}/" # Full file list update cd "${PRODUCTION_ROOT}/${CATEGORY_STUB}/" || { echo "Failed to change directory"; exit 1; } diff --git a/sync/sync-to-staging-9.sh b/sync/sync-to-staging-9.sh index ffcc6f1..4c18041 100644 --- a/sync/sync-to-staging-9.sh +++ b/sync/sync-to-staging-9.sh @@ -26,7 +26,7 @@ if [ $ret_val -eq "0" ]; then # shellcheck disable=SC2035 #sudo -l && find **/* -maxdepth 0 -type d | parallel --will-cite -j 18 sudo rsync -av --chown=10004:10005 --progress --relative --human-readable \ # {} "${TARGET}" - sudo -l && fpsync -o '-av --numeric-ids --no-compress --chown=10004:10005' -n 18 -t /mnt/compose/partitions "/mnt/compose/${MAJ}/latest-${SHORT}-${MAJ}${PROFILE}/compose/" "${TARGET}/" + sudo -l && time fpsync -o '-av --numeric-ids --no-compress --chown=10004:10005' -n 18 -t /mnt/compose/partitions "/mnt/compose/${MAJ}/latest-${SHORT}-${MAJ}${PROFILE}/compose/" "${TARGET}/" # This is temporary until we implement rsync into empanadas #if [ -f "COMPOSE_ID" ]; then