Appease shellcheck
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Luke Murphy 2020-09-08 08:58:49 +02:00
parent 0f6a6018bd
commit c29ce5cdda
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
1 changed files with 10 additions and 10 deletions

20
abra
View File

@ -1,7 +1,7 @@
#!/bin/bash
PROGRAM_NAME=$(basename $0)
PROGRAM_NAME=""$(basename "$0")
if [ -z $STACK_NAME ] || [ -z $STACK_NAME ]; then
if [ -z "$STACK_NAME" ] || [ -z "$STACK_NAME" ]; then
echo "ERROR: STACK_NAME must be set (e.g. export STACK_NAME=my_cool_app)"
exit
fi
@ -21,14 +21,14 @@ sub_secret_generate(){
SECRET=$1
VERSION=$2
if [ -z $SECRET ] || [ -z $VERSION ]; then
if [ -z "$SECRET" ] || [ -z "$VERSION" ]; then
echo "Usage: $PROGRAM_NAME secret_generate SECRET VERSION"
exit
fi
pwqgen | tee \
>(docker secret create "${STACK_NAME}_${SECRET}_${VERSION}" -) \
>(pass insert hosts/autonomic-swarm/${STACK_NAME}/${SECRET} -m)
>(pass insert "hosts/autonomic-swarm/${STACK_NAME}/${SECRET}" -m)
}
sub_service_run(){
@ -36,14 +36,14 @@ sub_service_run(){
SH=${2:-/bin/sh}
CONTAINER=$(docker container ls --format "table {{.ID}},{{.Names}}" \
| grep ${STACK_NAME}_${SERVICE} | cut -d',' -f1)
| grep "${STACK_NAME}_${SERVICE}" | cut -d',' -f1)
if [ -z $CONTAINER ]; then
if [ -z "$CONTAINER" ]; then
echo "Container not found! 🚨"
exit
fi
docker exec -it $CONTAINER $SH
docker exec -it "$CONTAINER" "$SH"
}
sub_deploy (){
@ -54,7 +54,7 @@ sub_deploy (){
echo "Domain: $(tput setaf 2)${DOMAIN}$(tput sgr0)"
echo "Stack: $(tput setaf 1)${STACK_NAME}$(tput sgr0)"
read -p "Continue? (y/[n])? " choice
read -rp "Continue? (y/[n])? " choice
case "$choice" in
y|Y ) ;;
@ -62,7 +62,7 @@ sub_deploy (){
* ) return;;
esac
docker stack deploy -c $COMPOSE $STACK_NAME
docker stack deploy -c "$COMPOSE" "$STACK_NAME"
}
subcommand=$1
@ -72,7 +72,7 @@ case $subcommand in
;;
*)
shift
sub_${subcommand} $@
"sub_${subcommand}" "$@"
if [ $? = 127 ]; then
echo "Error: '$subcommand' is not a known subcommand." >&2
echo " Run '$PROGRAM_NAME --help' for a list of known subcommands." >&2