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 <scott.little@windriver.com>
This commit is contained in:
Scott Little 2018-11-19 14:26:45 -05:00
parent 2a5e2d9100
commit fb3df727c0
2 changed files with 13 additions and 4 deletions

View File

@ -242,7 +242,6 @@ download () {
fi
else
echo "Already have $dest_dir/$rpm_name"
echo "already_there_srpm:$rpm_name" >> $LOG
fi
echo
done

View File

@ -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
}