Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle errors about third party download and extract #543

Merged
merged 5 commits into from
Dec 20, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Handle errors about third party download and extract
extract function return error number when invalid input is comming.

ISSUE=none
  • Loading branch information
cs-lee committed Dec 4, 2017
commit e9556093054b866be1302ce446e047fac902dfc8
10 changes: 6 additions & 4 deletions bootstrap/common/sync_third_party.sh
Original file line number Diff line number Diff line change
@@ -31,10 +31,11 @@ function sync_node() {

sync_third_party $base_url$target_url $target_path

if [ $? -eq 2 ]; then
local result=$?
if [ $result -eq 2 ]; then
error_log "node download fail"
exit
elif [ $? -eq 3 ]; then
elif [ $result -eq 3 ]; then
error_log "node extract fail"
exit
fi
@@ -54,10 +55,11 @@ function sync_mongodb() {

sync_third_party $base_url$target_url $target_path

if [ $? -eq 2 ]; then
local result=$?
if [ $result -eq 2 ]; then
error_log "mongodb download fail"
exit
elif [ $? -eq 3 ]; then
elif [ $result -eq 3 ]; then
error_log "mongodb extract fail"
exit
fi
1 change: 1 addition & 0 deletions bootstrap/common/util.sh
Original file line number Diff line number Diff line change
@@ -77,6 +77,7 @@ function extract_archive() {
case $src_path in
*.tar.gz|*.tgz) tar -xvzf $src_path -C $dest_path > /dev/null 2>&1 ;;
*.zip) unzip $src_path -d $dest_path > /dev/null 2>&1 ;;
*) return 3 ;;
esac

return $?