#3 Check file existence before upload
Merged 5 years ago by arrfab. Opened 5 years ago by pgreco.
pgreco/centos-git-common lookaside_update  into  master

file modified
+21 -1
@@ -71,8 +71,28 @@ 

    exit 1

  fi

  

- f_log "Initialing new upload to lookaside"

+ if [ ! -f "${file}" ] ;then

+   f_log "Source to upload ${file} not found"

+   exit 2

+ fi

+ 

  checksum=$(sha1sum ${file}|awk '{print $1}')

+ 

+ f_log "Checking if file already uploaded"

+ result=$(curl ${lookaside_baseurl}/sources/upload.cgi \

+ 	--fail \

+ 	-s \

+ 	--cert ~/.centos.cert \

+ 	--form "name=${pkgname}" \

+ 	--form "branch=${branch}" \

+ 	--form "sha1sum=${checksum}")

+ 

+ if [ "$result" = "Available" ] ;then

+   f_log "File already uploaded"

+   exit 3

+ fi

+ 

+ f_log "Initialing new upload to lookaside"

  f_log "URL : $lookaside_baseurl"

  f_log "Source to upload : ${file} "

  f_log "Package name: $pkgname"

When uploading a file to lookaside cache, check if it already exists

Pull-Request has been merged by arrfab

5 years ago
Metadata