Fixed lookaside_upload_sig for missing and wrong variables

Signed-off-by: Fabian Arrotin <arrfab@centos.org>
This commit is contained in:
Fabian Arrotin 2022-05-04 14:18:06 +02:00
parent 792d9ae960
commit ff65ce6b4a

View file

@ -78,8 +78,8 @@ checksum="$(${hash_parameter}sum ${file} | awk '{print $1}')"
f_log "Checking if file already uploaded" f_log "Checking if file already uploaded"
local_size=$(stat -c %s ${file}) local_size=$(stat -c %s ${file})
http_code=$(curl -s -o /dev/null -w "%{http_code}" ${lookaside_baseurl}/sources/${pkgname}/${file}/${hash_parameter}/${checksum}) http_code=$(curl -s -o /dev/null -w "%{http_code}" ${lookaside_baseurl}/sources/${pkgname}/${file}/${hash_parameter}/${checksum}/${file})
remote_size=$(curl --silent -i --head ${lookaside_baseurl}/sources/${pkgname}/${file}/${hash_parameter}/${checksum} | grep "Content-Length" | cut -f 2 -d ':' | tr -d [:blank:] | tr -d '\r') remote_size=$(curl --silent -i --head ${lookaside_baseurl}/sources/${pkgname}/${file}/${hash_parameter}/${checksum}/${file} | grep "Content-Length" | cut -f 2 -d ':' | tr -d [:blank:] | tr -d '\r')
if [ "$http_code" -eq 200 ] && [ "$local_size" -eq "$remote_size" ]; then if [ "$http_code" -eq 200 ] && [ "$local_size" -eq "$remote_size" ]; then
f_log "File already uploaded" f_log "File already uploaded"
@ -115,9 +115,9 @@ if [ "$upload_result" -ne "0" ]; then
fi fi
f_log "Validating that source was correctly uploaded ...." f_log "Validating that source was correctly uploaded ...."
remote_size=$(curl --silent -i --head ${lookaside_baseurl}/sources/${pkgname}/${file}/${hash}/${checksum} | grep "Content-Length" | cut -f 2 -d ':' | tr -d [:blank:] | tr -d '\r') remote_size=$(curl --silent -i --head ${lookaside_baseurl}/sources/${pkgname}/${file}/${hash_parameter}/${checksum}/${file} | grep "Content-Length" | cut -f 2 -d ':' | tr -d [:blank:] | tr -d '\r')
if [ "$local_size" -eq "$remote_size" ]; then if [ "$local_size" -eq "$remote_size" ]; then
f_log "[SUCCESS] Source should be available at ${lookaside_baseurl}/sources/${pkgname}/${file}/${hash}/${checksum}" f_log "[SUCCESS] Source should be available at ${lookaside_baseurl}/sources/${pkgname}/${file}/${hash_parameter}/${checksum}/${file}"
else else
f_log "[ERROR] it seems there is a mismatch with source size and remote file size" f_log "[ERROR] it seems there is a mismatch with source size and remote file size"
fi fi