Skip to content
Snippets Groups Projects
Commit 182e8302 authored by Dmitry Simonenko's avatar Dmitry Simonenko
Browse files

tarantool_expand.sh: deploy config read check, config instance number

validation added.
parent d1d89017
No related branches found
No related tags found
No related merge requests found
......@@ -43,7 +43,7 @@ error() {
}
log() {
echo "$prompt_name > $*"
echo "$prompt_name: $*"
}
usage() {
......@@ -64,6 +64,12 @@ usage() {
exit $1
}
is_numeric() {
num=$1
[ $num -eq $num ] 2>/dev/null && [ $num -ge 0 ] 2>/dev/null || \
return 1
}
rollback_instance() {
id=$1
workdir="${prefix_var}/tarantool$id"
......@@ -166,6 +172,10 @@ deploy_current=0
if [ -f $deploy_cfg ]; then
deploy_exists=1
deploy_current=`cat $deploy_cfg`
[ $? -eq 0 ] || error "failed to read deploy config"
# validating instance number
is_numeric $deploy_current
[ $? -eq 0 ] || error "bad deploy config instance number"
# dont' change deploy if it said so in configuration file
if [ $deploy_current -eq 0 ]; then
log "skipping deploy setup (cancel by config)"
......@@ -184,8 +194,8 @@ if [ $act_status -ne 0 ]; then
fi
# validating instance number
[ $deploy_count -eq $deploy_count ] 2>/dev/null && [ $deploy_count -gt 0 ] || \
error "bad instance number"
is_numeric $deploy_count
[ $? -eq 0 ] && [ $deploy_count -gt 0 ] || error "bad instance number"
if [ $deploy_count -le $deploy_current ]; then
error "expand only is supported (required instances number $deploy_count" \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment