added more error detections mechanisms to improve user information

This commit is contained in:
Guillaume Raffy 2023-12-13 11:26:49 +01:00
parent b3e9fec9a2
commit 8dbcb480fc
1 changed files with 18 additions and 0 deletions

View File

@ -226,10 +226,15 @@ deboco__init()
log 'error' "$debops_controller_path already exists" log 'error' "$debops_controller_path already exists"
return "$RETURNCODE_ERROR" return "$RETURNCODE_ERROR"
fi fi
local exit_code=''
local local_repos_path=$(controller__get_local_repos_path "$debops_controller_path") local local_repos_path=$(controller__get_local_repos_path "$debops_controller_path")
local ipr_debops_url='https://git.ipr.univ-rennes.fr/cellinfo/ansible.debops' local ipr_debops_url='https://git.ipr.univ-rennes.fr/cellinfo/ansible.debops'
log 'info' "cloning $ipr_debops_url into $local_repos_path" log 'info' "cloning $ipr_debops_url into $local_repos_path"
git clone https://git.ipr.univ-rennes.fr/cellinfo/ansible.debops "$local_repos_path" git clone https://git.ipr.univ-rennes.fr/cellinfo/ansible.debops "$local_repos_path"
if [ $? != "$RETURNCODE_SUCCESS" ]
then
return $RETURNCODE_ERROR
fi
local debops_env_path=$(controller__get_debops_env_path "$debops_controller_path") local debops_env_path=$(controller__get_debops_env_path "$debops_controller_path")
@ -292,6 +297,12 @@ deboco__init()
local virtual_env_path=$(controller__get_virtualenv_path "$debops_controller_path") local virtual_env_path=$(controller__get_virtualenv_path "$debops_controller_path")
# no need to call update-debops.sh since update-dev.sh does it # no need to call update-debops.sh since update-dev.sh does it
DEBOPS_VENV="$virtual_env_path" "$local_repos_path/bin/update-dev.sh" DEBOPS_VENV="$virtual_env_path" "$local_repos_path/bin/update-dev.sh"
exit_code=$?
if [ "$exit_code" != "$RETURNCODE_SUCCESS" ]
then
log 'error' "$local_repos_path/bin/update-dev.sh with DEBOPS_VENV=$virtual_env_path failed with exit code $exit_code"
return $RETURNCODE_ERROR
fi
controller__check_integrity "$debops_controller_path" controller__check_integrity "$debops_controller_path"
if [ $? != "$RETURNCODE_SUCCESS" ] if [ $? != "$RETURNCODE_SUCCESS" ]
@ -311,6 +322,7 @@ deboco__update()
return $RETURNCODE_ERROR return $RETURNCODE_ERROR
fi fi
local exit_code=''
reports_path="$(controller__get_reports_path "$debops_controller_path")" reports_path="$(controller__get_reports_path "$debops_controller_path")"
mkdir -p "${reports_path}" mkdir -p "${reports_path}"
@ -326,6 +338,12 @@ deboco__update()
log info "updating debops itself in $virtual_env_path" log info "updating debops itself in $virtual_env_path"
DEBOPS_VENV="$virtual_env_path" "$local_repos_path/bin/update-dev.sh" | tee --append ${report_file_path} DEBOPS_VENV="$virtual_env_path" "$local_repos_path/bin/update-dev.sh" | tee --append ${report_file_path}
exit_code=$?
if [ "$exit_code" != "$RETURNCODE_SUCCESS" ]
then
log 'error' "$local_repos_path/bin/update-dev.sh with DEBOPS_VENV=$virtual_env_path failed with exit code $exit_code"
return $RETURNCODE_ERROR
fi
controller__check_integrity "$debops_controller_path" controller__check_integrity "$debops_controller_path"
if [ $? != "$RETURNCODE_SUCCESS" ] if [ $? != "$RETURNCODE_SUCCESS" ]