Skip to content
Snippets Groups Projects
Commit b1925802 authored by André Anjos's avatar André Anjos :speech_balloon:
Browse files

Check if directory/file exists on disk before trying a dav_upload

parent 25ffe0f6
Branches
No related tags found
No related merge requests found
......@@ -193,6 +193,12 @@ setup_deploy() {
# $2: Path on the server to upload to (e.g. private-upload/wheels/gitlab/)
dav_upload() {
log_info "curl: ${1} -> ${DOCSERVER}/${2}..."
if [ ! -e $1 ]; then
log_error "File \`${1}\' does not exist on the local disk"
exit 1
fi
local code=`curl --location --silent --fail --write-out "%{http_code}" --user "${DOCUSER}:${DOCPASS}" --upload-file ${1} ${DOCSERVER}/${2}`
if [[ ${code} == *204 || ${code} == *201 ]]; then
log_info "Successfully uploaded ${1} with curl"
......@@ -252,6 +258,11 @@ dav_delete() {
dav_upload_folder() {
log_info "curl: ${1} -> ${DOCSERVER}/${2}..."
if [ ! -e $1 ]; then
log_error "Directory \`${1}\' does not exist on the local disk"
exit 1
fi
find "$1" | while read -r fname; do
# make sure the location has at least 1 '/' at the end
# more than 1 '/' together (e.g. '//') is interpreted as 1 '/'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment