From fb3df727c094e427f1d2e4c36aec6e42cd6aca8e Mon Sep 17 00:00:00 2001 From: Scott Little Date: Mon, 19 Nov 2018 14:26:45 -0500 Subject: [PATCH] failmoved logs polluted by non-errors Problem: The wiki states that one of the criteria for verifying a successful download_mirror.sh is that logs/*_failmove_*.log be empty. In reality the logs are not empty due to content improperly routed to these logs. e.g. logs/L1_failmoved_url_centos.log:url_srpm:http://mirror.starlingx.cengn.ca:80/mirror/centos/centos/mirror.centos.org/centos/7.5.1804/updates/x86_64/Packages/iptables-1.4.21-24.1.el7_5.i686.rpm logs/L1_failmoved_url_centos.log:http://mirror.starlingx.cengn.ca:80/mirror/centos/centos/mirror.centos.org/centos/7.5.1804/updates/x86_64/Packages/iptables-1.4.21-24.1.el7_5.x86_64.rpm logs/L1_failmoved_url_centos.log:found_srpm:iptables-1.4.21-24.1.el7_5.x86_64.rpm ... Solution: 1) 'url_srpm:' and 'found_srpm:' should not be routed to the _failmove_ log. We'll send those to stdout instead. 2) The http: log was traces to the get_url function returning two entries. It was discovered that appending --url to the yum download command causes it to ignore the --archlist arguement. As a result the output must be manually filtered to find the arch we are looking for. Story: 2003906 Task: 27974 Change-Id: Iabf0859ff3317acc1f298e9c791bd47b95366477 Signed-off-by: Scott Little --- centos-mirror-tools/dl_rpms.sh | 1 - centos-mirror-tools/utils.sh | 16 +++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/centos-mirror-tools/dl_rpms.sh b/centos-mirror-tools/dl_rpms.sh index 582b3e0f..54ff6281 100755 --- a/centos-mirror-tools/dl_rpms.sh +++ b/centos-mirror-tools/dl_rpms.sh @@ -242,7 +242,6 @@ download () { fi else echo "Already have $dest_dir/$rpm_name" - echo "already_there_srpm:$rpm_name" >> $LOG fi echo done diff --git a/centos-mirror-tools/utils.sh b/centos-mirror-tools/utils.sh index 6880f7c5..4d32cf4f 100644 --- a/centos-mirror-tools/utils.sh +++ b/centos-mirror-tools/utils.sh @@ -65,7 +65,14 @@ get_url() { fi else _url_cmd="$(get_yum_command $_name $_level)" - _ret="$($_url_cmd --url)" + + # When we add --url to the yum download command, + # --archlist is no longer enforced. Multiple + # url's might be returned. So use grep to + # filter urls for the desitered arch. + local arr=( $(split_filename $_name) ) + local arch=${arr[3]} + _ret="$($_url_cmd --url | grep "[.]$arch[.]rpm$")" fi echo "$_ret" } @@ -139,14 +146,17 @@ process_result() { mkdir -p $dest_dir fi - echo "url_srpm:$url" >> $LOG + echo "url_srpm:$url" if ! mv -f $sfile* $dest_dir ; then echo "FAILED to move $rpm_name" echo "fail_move_srpm:$rpm_name" >> $LOG + return 1 fi - echo "found_srpm:$rpm_name" >> $LOG + + echo "found_srpm:$rpm_name" echo $rpm_name >> $FOUND_SRPMS + return 0 }