Skip to content

Commit

Permalink
Fix missed \n and added better feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
clemens-tolboom committed Nov 6, 2023
1 parent 2694180 commit 1e87533
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions scripts/ops/armadilloctl.bash
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@

CURL_OPTS=--silent

OK="\033[32m"
WARN="\033[33m"
ERR="\033[31m"
B="\033[0m"

success() {
echo -e "${OK}${1}${B}"
}

warning() {
echo -e "WARNING: ${WARN}${1}${B}"
}
Expand Down Expand Up @@ -33,7 +38,7 @@ status() {

cmd="${ARMADILLO_URL}/ds-profiles/{$name}"
stats=$(curl $CURL_OPTS --user "${CREDENTIALS}" --request "GET" --header "accept: application/json" "${cmd}" | jq -r '"\(.name) = \(.container.status)"')
echo $stats
success "$stats"
}

start() {
Expand Down Expand Up @@ -121,6 +126,7 @@ autoStart() {
start "${item}"
fi
done
statusAll
}

check_dependencies() {
Expand All @@ -135,7 +141,7 @@ var_found() {
}

var_empty() {
echo "Variable $1 not set! ... exiting"
warning "Variable $1 not set! ... exiting"
exit 1
}

Expand All @@ -155,10 +161,11 @@ all_set() {

CREDENTIALS="${ARMADILLO_ADMIN_USER}:${ARMADILLO_ADMIN_PASSWORD}"

echo "\nArmadillo settings:"
echo " URL : ${ARMADILLO_URL}"
echo " ADMIN_USER : ${ARMADILLO_ADMIN_USER}"
echo " PROFILES_AUTOSTART : ${ARMADILLO_PROFILES_AUTOSTART}"
echo ""
echo "Armadillo settings:"
echo " ARMADILLO_URL : ${ARMADILLO_URL}"
echo " ARMADILLO_ADMIN_USER : ${ARMADILLO_ADMIN_USER}"
echo " ARMADILLO_PROFILES_AUTOSTART : ${ARMADILLO_PROFILES_AUTOSTART}"
}

check_dependencies || exit
Expand All @@ -172,5 +179,6 @@ get_profiles
if [[ "$1" =~ ^(status|start|stop|restart|statusAll|startAll|stopAll|restartAll|autoStart)$ ]]; then
"$@"
else
echo "\nPlease provide one of the following argument: status | start | stop | restart | statusAll | startAll | stopAll | restartAll | autoStart"
warning "Please provide one of the following arguments: status | start | stop | restart | statusAll | startAll | stopAll | restartAll | autoStart"
error "Got argument '$1'"
fi

0 comments on commit 1e87533

Please sign in to comment.